').appendTo(self.element);
+
+ //render the different parts
+ // nav links
+ self._renderCalendarButtons($calendarContainer);
+ // header
+ self._renderCalendarHeader($calendarContainer);
+ // body
+ self._renderCalendarBody($calendarContainer);
+
+ $weekDayColumns = $calendarContainer.find('.wc-day-column-inner');
+ $weekDayColumns.each(function(i, val) {
+ if (!options.readonly) {
+ self._addDroppableToWeekDay($(this));
+ if (options.allowEventCreation) {
+ self._setupEventCreationForWeekDay($(this));
+ }
+ }
+ });
+ },
+
+ /**
+ * render the nav buttons on top of the calendar
+ */
+ _renderCalendarButtons: function($calendarContainer) {
+ var self = this, options = this.options;
+ if ( !options.showHeader ) return;
+ if (options.buttons) {
+ var calendarNavHtml = '';
+
+ calendarNavHtml += '';
+
+ $(calendarNavHtml).appendTo($calendarContainer);
+
+ $calendarContainer.find('.wc-nav .wc-today')
+ .button({
+ icons: {primary: 'ui-icon-home'}})
+ .click(function() {
+ self.today();
+ return false;
+ });
+
+ $calendarContainer.find('.wc-nav .wc-prev')
+ .button({
+ text: false,
+ icons: {primary: 'ui-icon-seek-prev'}})
+ .click(function() {
+ self.element.weekCalendar('prev');
+ return false;
+ });
+
+ $calendarContainer.find('.wc-nav .wc-next')
+ .button({
+ text: false,
+ icons: {primary: 'ui-icon-seek-next'}})
+ .click(function() {
+ self.element.weekCalendar('next');
+ return false;
+ });
+
+ // now add buttons to switch display
+ if (this.options.switchDisplay && $.isPlainObject(this.options.switchDisplay)) {
+ var $container = $calendarContainer.find('.wc-display');
+ $.each(this.options.switchDisplay, function(label, option) {
+ var _id = 'wc-switch-display-' + option;
+ var _input = $('
');
+ _label.html(label);
+ _input.val(option);
+ if (parseInt(self.options.daysToShow, 10) === parseInt(option, 10)) {
+ _input.attr('checked', 'checked');
+ }
+ $container
+ .append(_input)
+ .append(_label);
+ });
+ $container.find('input').change(function() {
+ self.setDaysToShow(parseInt($(this).val(), 10));
+ });
+ }
+ $calendarContainer.find('.wc-nav, .wc-display').buttonset();
+ var _height = $calendarContainer.find('.wc-nav').outerHeight();
+ $calendarContainer.find('.wc-title')
+ .height(_height)
+ .css('line-height', _height + 'px');
+ }else{
+ var calendarNavHtml = '';
+ calendarNavHtml += '';
+ $(calendarNavHtml).appendTo($calendarContainer);
+
+ }
+ },
+
+ /**
+ * render the calendar header, including date and user header
+ */
+ _renderCalendarHeader: function($calendarContainer) {
+ var self = this, options = this.options,
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ rowspan = '', colspan = '', calendarHeaderHtml;
+
+ if (showAsSeparatedUser) {
+ rowspan = ' rowspan=\"2\"';
+ colspan = ' colspan=\"' + options.users.length + '\" ';
+ }
+
+ //first row
+ calendarHeaderHtml = '
';
+
+ $(calendarHeaderHtml).appendTo($calendarContainer);
+ },
+
+ /**
+ * render the calendar body.
+ * Calendar body is composed of several distinct parts.
+ * Each part is displayed in a separated row to ease rendering.
+ * for further explanations, see each part rendering function.
+ */
+ _renderCalendarBody: function($calendarContainer) {
+ var self = this, options = this.options,
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ $calendarBody, $calendarTableTbody;
+ // create the structure
+ $calendarBody = '
';
+ $calendarBody = $($calendarBody);
+ $calendarTableTbody = $calendarBody.find('tbody');
+
+ self._renderCalendarBodyTimeSlots($calendarTableTbody);
+ self._renderCalendarBodyOddEven($calendarTableTbody);
+ self._renderCalendarBodyFreeBusy($calendarTableTbody);
+ self._renderCalendarBodyEvents($calendarTableTbody);
+
+ $calendarBody.appendTo($calendarContainer);
+
+ //set the column height
+ $calendarContainer.find('.wc-full-height-column').height(options.timeslotHeight * options.timeslotsPerDay);
+ //set the timeslot height
+ $calendarContainer.find('.wc-time-slot').height(options.timeslotHeight - 1); //account for border
+ //init the time row header height
+ /**
+ TODO if total height for an hour is less than 11px, there is a display problem.
+ Find a way to handle it
+ */
+ $calendarContainer.find('.wc-time-header-cell').css({
+ height: (options.timeslotHeight * options.timeslotsPerHour) - 11,
+ padding: 5
+ });
+ //add the user data to every impacted column
+ if (showAsSeparatedUser) {
+ for (var i = 0, uLength = options.users.length; i < uLength; i++) {
+ $calendarContainer.find('.wc-user-' + self._getUserIdFromIndex(i))
+ .data('wcUser', options.users[i])
+ .data('wcUserIndex', i)
+ .data('wcUserId', self._getUserIdFromIndex(i));
+ }
+ }
+ },
+
+ /**
+ * render the timeslots separation
+ */
+ _renderCalendarBodyTimeSlots: function($calendarTableTbody) {
+ var options = this.options,
+ renderRow, i, j,
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ start = (options.businessHours.limitDisplay ? options.businessHours.start : 0),
+ end = (options.businessHours.limitDisplay ? options.businessHours.end : 24),
+ rowspan = 1;
+
+ //calculate the rowspan
+ if (options.displayOddEven) { rowspan += 1; }
+ if (options.displayFreeBusys) { rowspan += 1; }
+ if (rowspan > 1) {
+ rowspan = ' rowspan=\"' + rowspan + '\"';
+ }
+ else {
+ rowspan = '';
+ }
+
+ renderRow = '
';
+
+ $(renderRow).appendTo($calendarTableTbody);
+ },
+
+ /**
+ * render the odd even columns
+ */
+ _renderCalendarBodyOddEven: function($calendarTableTbody) {
+ if (this.options.displayOddEven) {
+ var options = this.options,
+ renderRow = '
';
+
+ $(renderRow).appendTo($calendarTableTbody);
+ }
+ },
+
+ /**
+ * render the freebusy placeholders
+ */
+ _renderCalendarBodyFreeBusy: function($calendarTableTbody) {
+ if (this.options.displayFreeBusys) {
+ var self = this, options = this.options,
+ renderRow = '
';
+
+ $(renderRow).appendTo($calendarTableTbody);
+ }
+ },
+
+ /**
+ * render the calendar body for event placeholders
+ */
+ _renderCalendarBodyEvents: function($calendarTableTbody) {
+ var self = this, options = this.options,
+ renderRow,
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ start = (options.businessHours.limitDisplay ? options.businessHours.start : 0),
+ end = (options.businessHours.limitDisplay ? options.businessHours.end : 24);
+ renderRow = '
';
+
+ $(renderRow).appendTo($calendarTableTbody);
+ },
+
+ /*
+ * setup mouse events for capturing new events
+ */
+ _setupEventCreationForWeekDay: function($weekDay) {
+ var self = this;
+ var options = this.options;
+ $weekDay.mousedown(function(event) {
+ var $target = $(event.target);
+ if ($target.hasClass('wc-day-column-inner')) {
+
+ var $newEvent = $('
');
+
+ $newEvent.css({lineHeight: (options.timeslotHeight - 2) + 'px', fontSize: (options.timeslotHeight / 2) + 'px'});
+ $target.append($newEvent);
+
+ var columnOffset = $target.offset().top;
+ var clickY = event.pageY - columnOffset;
+ var clickYRounded = (clickY - (clickY % options.timeslotHeight)) / options.timeslotHeight;
+ var topPosition = clickYRounded * options.timeslotHeight;
+ $newEvent.css({top: topPosition});
+
+ if (!options.preventDragOnEventCreation) {
+ $target.bind('mousemove.newevent', function(event) {
+ $newEvent.show();
+ $newEvent.addClass('ui-resizable-resizing');
+ var height = Math.round(event.pageY - columnOffset - topPosition);
+ var remainder = height % options.timeslotHeight;
+ //snap to closest timeslot
+ if (remainder < 0) {
+ var useHeight = height - remainder;
+ $newEvent.css('height', useHeight < options.timeslotHeight ? options.timeslotHeight : useHeight);
+ } else {
+ $newEvent.css('height', height + (options.timeslotHeight - remainder));
+ }
+ }).mouseup(function() {
+ $target.unbind('mousemove.newevent');
+ $newEvent.addClass('ui-corner-all');
+ });
+ }
+ }
+
+ }).mouseup(function(event) {
+ var $target = $(event.target);
+
+ var $weekDay = $target.closest('.wc-day-column-inner');
+ var $newEvent = $weekDay.find('.wc-new-cal-event-creating');
+
+ if ($newEvent.length) {
+ var createdFromSingleClick = !$newEvent.hasClass('ui-resizable-resizing');
+
+ //if even created from a single click only, default height
+ if (createdFromSingleClick) {
+ $newEvent.css({height: options.timeslotHeight * options.defaultEventLength}).show();
+ }
+ var top = parseInt($newEvent.css('top'));
+ var eventDuration = self._getEventDurationFromPositionedEventElement($weekDay, $newEvent, top);
+
+ $newEvent.remove();
+ var newCalEvent = {start: eventDuration.start, end: eventDuration.end, title: options.newEventText};
+ var showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length;
+
+ if (showAsSeparatedUser) {
+ newCalEvent = self._setEventUserId(newCalEvent, $weekDay.data('wcUserId'));
+ }
+ else if (!options.showAsSeparateUsers && options.users && options.users.length == 1) {
+ newCalEvent = self._setEventUserId(newCalEvent, self._getUserIdFromIndex(0));
+ }
+
+ var freeBusyManager = self.getFreeBusyManagerForEvent(newCalEvent);
+
+ var $renderedCalEvent = self._renderEvent(newCalEvent, $weekDay);
+
+ if (!options.allowCalEventOverlap) {
+ self._adjustForEventCollisions($weekDay, $renderedCalEvent, newCalEvent, newCalEvent);
+ self._positionEvent($weekDay, $renderedCalEvent);
+ } else {
+ self._adjustOverlappingEvents($weekDay);
+ }
+
+ var proceed = self._trigger('beforeEventNew', event, {
+ 'calEvent': newCalEvent,
+ 'createdFromSingleClick': createdFromSingleClick,
+ 'calendar': self.element
+ });
+ if (proceed) {
+ options.eventNew(newCalEvent, $renderedCalEvent, freeBusyManager, self.element, event);
+ }
+ else {
+ $($renderedCalEvent).remove();
+ }
+ }
+ });
+ },
+
+ /*
+ * load calendar events for the week based on the date provided
+ */
+ _loadCalEvents: function(dateWithinWeek) {
+
+ var date, weekStartDate, weekEndDate, $weekDayColumns;
+ var self = this;
+ var options = this.options;
+ date = this._fixMinMaxDate(dateWithinWeek || options.date);
+ // if date is not provided
+ // or was not set
+ // or is different than old one
+ if ((!date || !date.getTime) ||
+ (!options.date || !options.date.getTime) ||
+ date.getTime() != options.date.getTime()
+ ) {
+ // trigger the changedate event
+ this._trigger('changedate', this.element, date);
+ }
+ this.options.date = date;
+ weekStartDate = self._dateFirstDayOfWeek(date);
+ weekEndDate = self._dateLastMilliOfWeek(date);
+
+ options.calendarBeforeLoad(self.element);
+
+ self.element.data('startDate', weekStartDate);
+ self.element.data('endDate', weekEndDate);
+
+ $weekDayColumns = self.element.find('.wc-day-column-inner');
+
+ self._updateDayColumnHeader($weekDayColumns);
+
+ //load events by chosen means
+ if (typeof options.data == 'string') {
+ if (options.loading) {
+ options.loading(true);
+ }
+ if (_currentAjaxCall) {
+ // first abort current request.
+ if (!_jQuery14OrLower) {
+ _currentAjaxCall.abort();
+ } else {
+ // due to the fact that jquery 1.4 does not detect a request was
+ // aborted, we need to replace the onreadystatechange and
+ // execute the "complete" callback.
+ _currentAjaxCall.onreadystatechange = null;
+ _currentAjaxCall.abort();
+ _currentAjaxCall = null;
+ if (options.loading) {
+ options.loading(false);
+ }
+ }
+ }
+ var jsonOptions = self._getJsonOptions();
+ jsonOptions[options.startParam || 'start'] = Math.round(weekStartDate.getTime() / 1000);
+ jsonOptions[options.endParam || 'end'] = Math.round(weekEndDate.getTime() / 1000);
+ _currentAjaxCall = $.ajax({
+ url: options.data,
+ data: jsonOptions,
+ dataType: 'json',
+ error: function(XMLHttpRequest, textStatus, errorThrown) {
+ // only prevent error with jQuery 1.5
+ // see issue #34. thanks to dapplebeforedawn
+ // (https://github.com/themouette/jquery-week-calendar/issues#issue/34)
+ // for 1.5+, aborted request mean errorThrown == 'abort'
+ // for prior version it means !errorThrown && !XMLHttpRequest.status
+ // fixes #55
+ if (errorThrown != 'abort' && XMLHttpRequest.status != 0) {
+ alert('unable to get data, error:' + textStatus);
+ }
+ },
+ success: function(data) {
+ self._renderEvents(data, $weekDayColumns);
+ },
+ complete: function() {
+ _currentAjaxCall = null;
+ if (options.loading) {
+ options.loading(false);
+ }
+ }
+ });
+ }
+ else if ($.isFunction(options.data)) {
+ options.data(weekStartDate, weekEndDate,
+ function(data) {
+ self._renderEvents(data, $weekDayColumns);
+ });
+ }
+ else if (options.data) {
+ self._renderEvents(options.data, $weekDayColumns);
+ }
+
+ self._disableTextSelect($weekDayColumns);
+ },
+
+ /**
+ * Draws a thin line which indicates the current time.
+ */
+ _drawCurrentHourLine: function() {
+ var d = new Date(),
+ options = this.options,
+ businessHours = options.businessHours;
+
+ // first, we remove the old hourline if it exists
+ $('.wc-hourline', this.element).remove();
+
+ // the line does not need to be displayed
+ if (businessHours.limitDisplay && d.getHours() > businessHours.end) {
+ return;
+ }
+
+ // then we recreate it
+ var paddingStart = businessHours.limitDisplay ? businessHours.start : 0;
+ var nbHours = d.getHours() - paddingStart + d.getMinutes() / 60;
+ var positionTop = nbHours * options.timeslotHeight * options.timeslotsPerHour;
+ var lineWidth = $('.wc-scrollable-grid .wc-today', this.element).width() + 3;
+
+ $('.wc-scrollable-grid .wc-today', this.element).append(
+ $('
', {
+ 'class': 'wc-hourline',
+ style: 'top: ' + positionTop + 'px; width: ' + lineWidth + 'px'
+ })
+ );
+ },
+
+ /*
+ * update the display of each day column header based on the calendar week
+ */
+ _updateDayColumnHeader: function($weekDayColumns) {
+ var self = this;
+ var options = this.options;
+ var currentDay = self._cloneDate(self.element.data('startDate'));
+ var showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length;
+ var todayClass = 'ui-state-active wc-today';
+
+ self.element.find('.wc-header td.wc-day-column-header').each(function(i, val) {
+ $(this).html(self._getHeaderDate(currentDay));
+ if (self._isToday(currentDay)) {
+ $(this).addClass(todayClass);
+ } else {
+ $(this).removeClass(todayClass);
+ }
+ currentDay = self._addDays(currentDay, 1);
+
+ });
+
+ currentDay = self._cloneDate(self.element.data('startDate'));
+ if (showAsSeparatedUser)
+ {
+ self.element.find('.wc-header td.wc-user-header').each(function(i, val) {
+ if (self._isToday(currentDay)) {
+ $(this).addClass(todayClass);
+ } else {
+ $(this).removeClass(todayClass);
+ }
+ currentDay = ((i + 1) % options.users.length) ? currentDay : self._addDays(currentDay, 1);
+ });
+ }
+
+ currentDay = self._cloneDate(self.element.data('startDate'));
+
+ $weekDayColumns.each(function(i, val) {
+
+ $(this).data('startDate', self._cloneDate(currentDay));
+ $(this).data('endDate', new Date(currentDay.getTime() + (MILLIS_IN_DAY)));
+ if (self._isToday(currentDay)) {
+ $(this).parent()
+ .addClass(todayClass)
+ .removeClass('ui-state-default');
+ } else {
+ $(this).parent()
+ .removeClass(todayClass)
+ .addClass('ui-state-default');
+ }
+
+ if (!showAsSeparatedUser || !((i + 1) % options.users.length)) {
+ currentDay = self._addDays(currentDay, 1);
+ }
+ });
+
+ //now update the freeBusy placeholders
+ if (options.displayFreeBusys) {
+ currentDay = self._cloneDate(self.element.data('startDate'));
+ self.element.find('.wc-grid-row-freebusy .wc-column-freebusy').each(function(i, val) {
+ $(this).data('startDate', self._cloneDate(currentDay));
+ $(this).data('endDate', new Date(currentDay.getTime() + (MILLIS_IN_DAY)));
+ if (!showAsSeparatedUser || !((i + 1) % options.users.length)) {
+ currentDay = self._addDays(currentDay, 1);
+ }
+ });
+ }
+
+ // now update the calendar title
+ if (this.options.title) {
+ var date = this.options.date,
+ start = self._cloneDate(self.element.data('startDate')),
+ end = self._dateLastDayOfWeek(new Date(this._cloneDate(self.element.data('endDate')).getTime() - (MILLIS_IN_DAY))),
+ title = this._getCalendarTitle(),
+ date_format = options.dateFormat;
+
+ // replace the placeholders contained in the title
+ title = title.replace('%start%', self._formatDate(start, date_format));
+ title = title.replace('%end%', self._formatDate(end, date_format));
+ title = title.replace('%date%', self._formatDate(date, date_format));
+
+ $('.wc-toolbar .wc-title', self.element).html(title);
+ }
+ //self._clearFreeBusys();
+ },
+
+ /**
+ * Gets the calendar raw title.
+ */
+ _getCalendarTitle: function() {
+ if ($.isFunction(this.options.title)) {
+ return this.options.title(this.options.daysToShow);
+ }
+
+ return this.options.title || '';
+ },
+
+ /**
+ * Render the events into the calendar
+ */
+ _renderEvents: function(data, $weekDayColumns) {
+ var self = this;
+ var options = this.options;
+ var eventsToRender, nbRenderedEvents = 0;
+
+ if (data.options) {
+ var updateLayout = false;
+ // update options
+ $.each(data.options, function(key, value) {
+ if (value !== options[key]) {
+ options[key] = value;
+ updateLayout = updateLayout || $.ui.weekCalendar.updateLayoutOptions[key];
+ }
+ });
+
+ self._computeOptions();
+
+ if (updateLayout) {
+ var hour = self._getCurrentScrollHour();
+ self.element.empty();
+ self._renderCalendar();
+ $weekDayColumns = self.element.find('.wc-time-slots .wc-day-column-inner');
+ self._updateDayColumnHeader($weekDayColumns);
+ self._resizeCalendar();
+ self._scrollToHour(hour, false);
+ }
+ }
+ this._clearCalendar();
+
+ if ($.isArray(data)) {
+ eventsToRender = self._cleanEvents(data);
+ } else if (data.events) {
+ eventsToRender = self._cleanEvents(data.events);
+ self._renderFreeBusys(data);
+ }
+
+ $.each(eventsToRender, function(i, calEvent) {
+ // render a multi day event as various event :
+ // thanks to http://github.com/fbeauchamp/jquery-week-calendar
+ var initialStart = new Date(calEvent.start);
+ var initialEnd = new Date(calEvent.end);
+ var maxHour = self.options.businessHours.limitDisplay ? self.options.businessHours.end : 24;
+ var minHour = self.options.businessHours.limitDisplay ? self.options.businessHours.start : 0;
+ var start = new Date(initialStart);
+ var startDate = self._formatDate(start, 'Ymd');
+ var endDate = self._formatDate(initialEnd, 'Ymd');
+ var $weekDay;
+ var isMultiday = false;
+
+ while (startDate < endDate) {
+ calEvent.start = start;
+
+ // end of this virual calEvent is set to the end of the day
+ calEvent.end.setFullYear(start.getFullYear());
+ calEvent.end.setDate(start.getDate());
+ calEvent.end.setMonth(start.getMonth());
+ calEvent.end.setHours(maxHour, 0, 0);
+
+ if (($weekDay = self._findWeekDayForEvent(calEvent, $weekDayColumns))) {
+ self._renderEvent(calEvent, $weekDay);
+ nbRenderedEvents += 1;
+ }
+
+ // start is set to the begin of the new day
+ start.setDate(start.getDate() + 1);
+ start.setHours(minHour, 0, 0);
+
+ startDate = self._formatDate(start, 'Ymd');
+ isMultiday = true;
+ }
+
+ if (start <= initialEnd) {
+ calEvent.start = start;
+ calEvent.end = initialEnd;
+
+ if (((isMultiday && calEvent.start.getTime() != calEvent.end.getTime()) || !isMultiday) && ($weekDay = self._findWeekDayForEvent(calEvent, $weekDayColumns))) {
+ self._renderEvent(calEvent, $weekDay);
+ nbRenderedEvents += 1;
+ }
+ }
+
+ // put back the initial start date
+ calEvent.start = initialStart;
+ });
+
+ $weekDayColumns.each(function() {
+ self._adjustOverlappingEvents($(this));
+ });
+
+ options.calendarAfterLoad(self.element);
+
+ _hourLineTimeout && clearInterval(_hourLineTimeout);
+
+ if (options.hourLine) {
+ self._drawCurrentHourLine();
+
+ _hourLineTimeout = setInterval(function() {
+ self._drawCurrentHourLine();
+ }, 60 * 1000); // redraw the line each minute
+ }
+
+ !nbRenderedEvents && options.noEvents();
+ },
+
+ /*
+ * Render a specific event into the day provided. Assumes correct
+ * day for calEvent date
+ */
+ _renderEvent: function(calEvent, $weekDay) {
+ var self = this;
+ var options = this.options;
+ if (calEvent.start.getTime() > calEvent.end.getTime()) {
+ return; // can't render a negative height
+ }
+
+ var eventClass, eventHtml, $calEventList, $modifiedEvent;
+
+ eventClass = calEvent.id ? 'wc-cal-event' : 'wc-cal-event wc-new-cal-event';
+ eventHtml = '
';
+ eventHtml += '
';
+ eventHtml += '
';
+
+ $weekDay.each(function() {
+ var $calEvent = $(eventHtml);
+ $modifiedEvent = options.eventRender(calEvent, $calEvent);
+ $calEvent = $modifiedEvent ? $modifiedEvent.appendTo($(this)) : $calEvent.appendTo($(this));
+ $calEvent.css({lineHeight: (options.textSize + 2) + 'px', fontSize: options.textSize + 'px'});
+
+ self._refreshEventDetails(calEvent, $calEvent);
+ self._positionEvent($(this), $calEvent);
+
+ //add to event list
+ if ($calEventList) {
+ $calEventList = $calEventList.add($calEvent);
+ }
+ else {
+ $calEventList = $calEvent;
+ }
+ });
+ $calEventList.show();
+
+ if (!options.readonly && options.resizable(calEvent, $calEventList)) {
+ self._addResizableToCalEvent(calEvent, $calEventList, $weekDay);
+ }
+ if (!options.readonly && options.draggable(calEvent, $calEventList)) {
+ self._addDraggableToCalEvent(calEvent, $calEventList);
+ }
+ options.eventAfterRender(calEvent, $calEventList);
+
+ return $calEventList;
+
+ },
+ addEvent: function() {
+ return this._renderEvent.apply(this, arguments);
+ },
+
+ _adjustOverlappingEvents: function($weekDay) {
+ var self = this;
+ if (self.options.allowCalEventOverlap) {
+ var groupsList = self._groupOverlappingEventElements($weekDay);
+ $.each(groupsList, function() {
+ var curGroups = this;
+ $.each(curGroups, function(groupIndex) {
+ var curGroup = this;
+
+ // do we want events to be displayed as overlapping
+ if (self.options.overlapEventsSeparate) {
+ var newWidth = self.options.totalEventsWidthPercentInOneColumn / curGroups.length;
+ var newLeft = groupIndex * newWidth;
+ } else {
+ // TODO what happens when the group has more than 10 elements
+ var newWidth = self.options.totalEventsWidthPercentInOneColumn - ((curGroups.length - 1) * 10);
+ var newLeft = groupIndex * 10;
+ }
+ $.each(curGroup, function() {
+ // bring mouseovered event to the front
+ if (!self.options.overlapEventsSeparate) {
+ $(this).bind('mouseover.z-index', function() {
+ var $elem = $(this);
+ $.each(curGroup, function() {
+ $(this).css({'z-index': '1'});
+ });
+ $elem.css({'z-index': '3'});
+ });
+ }
+ $(this).css({width: newWidth + '%', left: newLeft + '%', right: 0});
+ });
+ });
+ });
+ }
+ },
+
+
+ /*
+ * Find groups of overlapping events
+ */
+ _groupOverlappingEventElements: function($weekDay) {
+ var $events = $weekDay.find('.wc-cal-event:visible');
+ var sortedEvents = $events.sort(function(a, b) {
+ return $(a).data('calEvent').start.getTime() - $(b).data('calEvent').start.getTime();
+ });
+
+ var lastEndTime = new Date(0, 0, 0);
+ var groups = [];
+ var curGroups = [];
+ var $curEvent;
+ $.each(sortedEvents, function() {
+ $curEvent = $(this);
+ //checks, if the current group list is not empty, if the overlapping is finished
+ if (curGroups.length > 0) {
+ if (lastEndTime.getTime() <= $curEvent.data('calEvent').start.getTime()) {
+ //finishes the current group list by adding it to the resulting list of groups and cleans it
+
+ groups.push(curGroups);
+ curGroups = [];
+ }
+ }
+
+ //finds the first group to fill with the event
+ for (var groupIndex = 0; groupIndex < curGroups.length; groupIndex++) {
+ if (curGroups[groupIndex].length > 0) {
+ //checks if the event starts after the end of the last event of the group
+ if (curGroups[groupIndex][curGroups[groupIndex].length - 1].data('calEvent').end.getTime() <= $curEvent.data('calEvent').start.getTime()) {
+ curGroups[groupIndex].push($curEvent);
+ if (lastEndTime.getTime() < $curEvent.data('calEvent').end.getTime()) {
+ lastEndTime = $curEvent.data('calEvent').end;
+ }
+ return;
+ }
+ }
+ }
+ //if not found, creates a new group
+ curGroups.push([$curEvent]);
+ if (lastEndTime.getTime() < $curEvent.data('calEvent').end.getTime()) {
+ lastEndTime = $curEvent.data('calEvent').end;
+ }
+ });
+ //adds the last groups in result
+ if (curGroups.length > 0) {
+ groups.push(curGroups);
+ }
+ return groups;
+ },
+
+
+ /*
+ * find the weekday in the current calendar that the calEvent falls within
+ */
+ _findWeekDayForEvent: function(calEvent, $weekDayColumns) {
+
+ var $weekDay,
+ options = this.options,
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ user_ids = this._getEventUserId(calEvent);
+
+ if (!$.isArray(user_ids)) {
+ user_ids = [user_ids];
+ }
+
+ $weekDayColumns.each(function(index, curDay) {
+ if ($(this).data('startDate').getTime() <= calEvent.start.getTime() &&
+ $(this).data('endDate').getTime() >= calEvent.end.getTime() &&
+ (!showAsSeparatedUser || $.inArray($(this).data('wcUserId'), user_ids) !== -1)
+ ) {
+ if ($weekDay) {
+ $weekDay = $weekDay.add($(curDay));
+ }
+ else {
+ $weekDay = $(curDay);
+ }
+ }
+ });
+
+ return $weekDay;
+ },
+
+ /*
+ * update the events rendering in the calendar. Add if does not yet exist.
+ */
+ _updateEventInCalendar: function(calEvent) {
+ var self = this;
+ self._cleanEvent(calEvent);
+
+ if (calEvent.id) {
+ self.element.find('.wc-cal-event').each(function() {
+ if ($(this).data('calEvent').id === calEvent.id || $(this).hasClass('wc-new-cal-event')) {
+ $(this).remove();
+ // return false;
+ }
+ });
+ }
+
+ var $weekDays = self._findWeekDayForEvent(calEvent, self.element.find('.wc-grid-row-events .wc-day-column-inner'));
+ if ($weekDays) {
+ $weekDays.each(function(index, weekDay) {
+ var $weekDay = $(weekDay);
+ var $calEvent = self._renderEvent(calEvent, $weekDay);
+ self._adjustForEventCollisions($weekDay, $calEvent, calEvent, calEvent);
+ self._refreshEventDetails(calEvent, $calEvent);
+ self._positionEvent($weekDay, $calEvent);
+ self._adjustOverlappingEvents($weekDay);
+ });
+ }
+ },
+
+ /*
+ * Position the event element within the weekday based on it's start / end dates.
+ */
+ _positionEvent: function($weekDay, $calEvent) {
+ var options = this.options;
+ var calEvent = $calEvent.data('calEvent');
+ var pxPerMillis = $weekDay.height() / options.millisToDisplay;
+ var firstHourDisplayed = options.businessHours.limitDisplay ? options.businessHours.start : 0;
+ var startMillis = this._getDSTdayShift(calEvent.start).getTime() - this._getDSTdayShift(new Date(calEvent.start.getFullYear(), calEvent.start.getMonth(), calEvent.start.getDate(), firstHourDisplayed)).getTime();
+ var eventMillis = this._getDSTdayShift(calEvent.end).getTime() - this._getDSTdayShift(calEvent.start).getTime();
+ var pxTop = pxPerMillis * startMillis;
+ var pxHeight = pxPerMillis * eventMillis;
+ //var pxHeightFallback = pxPerMillis * (60 / options.timeslotsPerHour) * 60 * 1000;
+ $calEvent.css({top: pxTop, height: pxHeight || (pxPerMillis * 3600000 / options.timeslotsPerHour)});
+ },
+
+ /*
+ * Determine the actual start and end times of a calevent based on it's
+ * relative position within the weekday column and the starting hour of the
+ * displayed calendar.
+ */
+ _getEventDurationFromPositionedEventElement: function($weekDay, $calEvent, top) {
+ var options = this.options;
+ var startOffsetMillis = options.businessHours.limitDisplay ? options.businessHours.start * 3600000 : 0;
+ var start = new Date($weekDay.data('startDate').getTime() + startOffsetMillis + Math.round(top / options.timeslotHeight) * options.millisPerTimeslot);
+ var end = new Date(start.getTime() + ($calEvent.height() / options.timeslotHeight) * options.millisPerTimeslot);
+ return {start: this._getDSTdayShift(start, -1), end: this._getDSTdayShift(end, -1)};
+ },
+
+ /*
+ * If the calendar does not allow event overlap, adjust the start or end date if necessary to
+ * avoid overlapping of events. Typically, shortens the resized / dropped event to it's max possible
+ * duration based on the overlap. If no satisfactory adjustment can be made, the event is reverted to
+ * it's original location.
+ */
+ _adjustForEventCollisions: function($weekDay, $calEvent, newCalEvent, oldCalEvent, maintainEventDuration) {
+ var options = this.options;
+
+ if (options.allowCalEventOverlap) {
+ return;
+ }
+ var adjustedStart, adjustedEnd;
+ var self = this;
+
+ $weekDay.find('.wc-cal-event').not($calEvent).each(function() {
+ var currentCalEvent = $(this).data('calEvent');
+
+ //has been dropped onto existing event overlapping the end time
+ if (newCalEvent.start.getTime() < currentCalEvent.end.getTime() &&
+ newCalEvent.end.getTime() >= currentCalEvent.end.getTime()) {
+
+ adjustedStart = currentCalEvent.end;
+ }
+
+
+ //has been dropped onto existing event overlapping the start time
+ if (newCalEvent.end.getTime() > currentCalEvent.start.getTime() &&
+ newCalEvent.start.getTime() <= currentCalEvent.start.getTime()) {
+
+ adjustedEnd = currentCalEvent.start;
+ }
+ //has been dropped inside existing event with same or larger duration
+ if (oldCalEvent.resizable == false ||
+ (newCalEvent.end.getTime() <= currentCalEvent.end.getTime() &&
+ newCalEvent.start.getTime() >= currentCalEvent.start.getTime())) {
+
+ adjustedStart = oldCalEvent.start;
+ adjustedEnd = oldCalEvent.end;
+ return false;
+ }
+
+ });
+
+
+ newCalEvent.start = adjustedStart || newCalEvent.start;
+
+ if (adjustedStart && maintainEventDuration) {
+ newCalEvent.end = new Date(adjustedStart.getTime() + (oldCalEvent.end.getTime() - oldCalEvent.start.getTime()));
+ self._adjustForEventCollisions($weekDay, $calEvent, newCalEvent, oldCalEvent);
+ } else {
+ newCalEvent.end = adjustedEnd || newCalEvent.end;
+ }
+
+
+ //reset if new cal event has been forced to zero size
+ if (newCalEvent.start.getTime() >= newCalEvent.end.getTime()) {
+ newCalEvent.start = oldCalEvent.start;
+ newCalEvent.end = oldCalEvent.end;
+ }
+
+ $calEvent.data('calEvent', newCalEvent);
+ },
+
+ /**
+ * Add draggable capabilities to an event
+ */
+ _addDraggableToCalEvent: function(calEvent, $calEvent) {
+ var options = this.options;
+
+ $calEvent.draggable({
+ handle: '.wc-time',
+ containment: 'div.wc-time-slots',
+ snap: '.wc-day-column-inner',
+ snapMode: 'inner',
+ snapTolerance: options.timeslotHeight - 1,
+ revert: 'invalid',
+ opacity: 0.5,
+ grid: [$calEvent.outerWidth() + 1, options.timeslotHeight],
+ start: function(event, ui) {
+ var $calEvent = ui.draggable || ui.helper;
+ options.eventDrag(calEvent, $calEvent);
+ }
+ });
+ },
+
+ /*
+ * Add droppable capabilites to weekdays to allow dropping of calEvents only
+ */
+ _addDroppableToWeekDay: function($weekDay) {
+ var self = this;
+ var options = this.options;
+ $weekDay.droppable({
+ accept: '.wc-cal-event',
+ drop: function(event, ui) {
+ var $calEvent = ui.draggable;
+ var top = Math.round(parseInt(ui.position.top));
+ var eventDuration = self._getEventDurationFromPositionedEventElement($weekDay, $calEvent, top);
+ var calEvent = $calEvent.data('calEvent');
+ var newCalEvent = $.extend(true, {}, calEvent, {start: eventDuration.start, end: eventDuration.end});
+ var showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length;
+ if (showAsSeparatedUser) {
+ // we may have dragged the event on column with a new user.
+ // nice way to handle that is:
+ // - get the newly dragged on user
+ // - check if user is part of the event
+ // - if yes, nothing changes, if not, find the old owner to remove it and add new one
+ var newUserId = $weekDay.data('wcUserId');
+ var userIdList = self._getEventUserId(calEvent);
+ var oldUserId = $(ui.draggable.parents('.wc-day-column-inner').get(0)).data('wcUserId');
+ if (!$.isArray(userIdList)) {
+ userIdList = [userIdList];
+ }
+ if ($.inArray(newUserId, userIdList) == -1) {
+ // remove old user
+ var _index = $.inArray(oldUserId, userIdList);
+ userIdList.splice(_index, 1);
+ // add new user ?
+ if ($.inArray(newUserId, userIdList) == -1) {
+ userIdList.push(newUserId);
+ }
+ }
+ newCalEvent = self._setEventUserId(newCalEvent, ((userIdList.length == 1) ? userIdList[0] : userIdList));
+ }
+ self._adjustForEventCollisions($weekDay, $calEvent, newCalEvent, calEvent, true);
+ var $weekDayColumns = self.element.find('.wc-day-column-inner');
+
+ //trigger drop callback
+ options.eventDrop(newCalEvent, calEvent, $calEvent);
+
+ var $newEvent = self._renderEvent(newCalEvent, self._findWeekDayForEvent(newCalEvent, $weekDayColumns));
+ $calEvent.hide();
+
+ $calEvent.data('preventClick', true);
+
+ var $weekDayOld = self._findWeekDayForEvent($calEvent.data('calEvent'), self.element.find('.wc-time-slots .wc-day-column-inner'));
+
+ if ($weekDayOld.data('startDate') != $weekDay.data('startDate')) {
+ self._adjustOverlappingEvents($weekDayOld);
+ }
+ self._adjustOverlappingEvents($weekDay);
+
+ setTimeout(function() {
+ $calEvent.remove();
+ }, 1000);
+
+ }
+ });
+ },
+
+ /*
+ * Add resizable capabilities to a calEvent
+ */
+ _addResizableToCalEvent: function(calEvent, $calEvent, $weekDay) {
+ var self = this;
+ var options = this.options;
+ $calEvent.resizable({
+ grid: options.timeslotHeight,
+ containment: $weekDay,
+ handles: 's',
+ minHeight: options.timeslotHeight,
+ stop: function(event, ui) {
+ var $calEvent = ui.element;
+ var newEnd = new Date($calEvent.data('calEvent').start.getTime() + Math.max(1, Math.round(ui.size.height / options.timeslotHeight)) * options.millisPerTimeslot);
+ if (self._needDSTdayShift($calEvent.data('calEvent').start, newEnd))
+ newEnd = self._getDSTdayShift(newEnd, -1);
+ var newCalEvent = $.extend(true, {}, calEvent, {start: calEvent.start, end: newEnd});
+ self._adjustForEventCollisions($weekDay, $calEvent, newCalEvent, calEvent);
+
+ //trigger resize callback
+ options.eventResize(newCalEvent, calEvent, $calEvent);
+ self._refreshEventDetails(newCalEvent, $calEvent);
+ self._positionEvent($weekDay, $calEvent);
+ self._adjustOverlappingEvents($weekDay);
+ $calEvent.data('preventClick', true);
+ setTimeout(function() {
+ $calEvent.removeData('preventClick');
+ }, 500);
+ }
+ });
+ $('.ui-resizable-handle', $calEvent).text('=');
+ },
+
+ /*
+ * Refresh the displayed details of a calEvent in the calendar
+ */
+ _refreshEventDetails: function(calEvent, $calEvent) {
+ var suffix = '';
+ if (!this.options.readonly &&
+ this.options.allowEventDelete &&
+ this.options.deletable(calEvent,$calEvent)) {
+ suffix = '
';
+ }
+ $calEvent.find('.wc-time').html(this.options.eventHeader(calEvent, this.element) + suffix);
+ $calEvent.find('.wc-title').html(this.options.eventBody(calEvent, this.element));
+ $calEvent.data('calEvent', calEvent);
+ this.options.eventRefresh(calEvent, $calEvent);
+ },
+
+ /*
+ * Clear all cal events from the calendar
+ */
+ _clearCalendar: function() {
+ this.element.find('.wc-day-column-inner div').remove();
+ this._clearFreeBusys();
+ },
+
+ /*
+ * Scroll the calendar to a specific hour
+ */
+ _scrollToHour: function(hour, animate) {
+ var self = this;
+ var options = this.options;
+ var $scrollable = this.element.find('.wc-scrollable-grid');
+ var slot = hour;
+ if (self.options.businessHours.limitDisplay) {
+ if (hour <= self.options.businessHours.start) {
+ slot = 0;
+ } else if (hour >= self.options.businessHours.end) {
+ slot = self.options.businessHours.end - self.options.businessHours.start - 1;
+ } else {
+ slot = hour - self.options.businessHours.start;
+ }
+ }
+
+ var $target = this.element.find('.wc-grid-timeslot-header .wc-hour-header:eq(' + slot + ')');
+
+ $scrollable.animate({scrollTop: 0}, 0, function() {
+ var targetOffset = $target.offset().top;
+ var scroll = targetOffset - $scrollable.offset().top - $target.outerHeight();
+ if (animate) {
+ $scrollable.animate({scrollTop: scroll}, options.scrollToHourMillis);
+ }
+ else {
+ $scrollable.animate({scrollTop: scroll}, 0);
+ }
+ });
+ },
+
+ /*
+ * find the hour (12 hour day) for a given hour index
+ */
+ _hourForIndex: function(index) {
+ if (index === 0) { //midnight
+ return 12;
+ } else if (index < 13) { //am
+ return index;
+ } else { //pm
+ return index - 12;
+ }
+ },
+
+ _24HourForIndex: function(index) {
+ if (index === 0) { //midnight
+ return '00:00';
+ } else if (index < 10) {
+ return '0' + index + ':00';
+ } else {
+ return index + ':00';
+ }
+ },
+
+ _amOrPm: function(hourOfDay) {
+ return hourOfDay < 12 ? 'AM' : 'PM';
+ },
+
+ _isToday: function(date) {
+ var clonedDate = this._cloneDate(date);
+ this._clearTime(clonedDate);
+ var today = new Date();
+ this._clearTime(today);
+ return today.getTime() === clonedDate.getTime();
+ },
+
+ /*
+ * Clean events to ensure correct format
+ */
+ _cleanEvents: function(events) {
+ var self = this;
+ $.each(events, function(i, event) {
+ self._cleanEvent(event);
+ });
+ return events;
+ },
+
+ /*
+ * Clean specific event
+ */
+ _cleanEvent: function(event) {
+ if (event.date) {
+ event.start = event.date;
+ }
+ event.start = this._cleanDate(event.start);
+ event.end = this._cleanDate(event.end);
+ if (!event.end) {
+ event.end = this._addDays(this._cloneDate(event.start), 1);
+ }
+ },
+
+ /*
+ * Disable text selection of the elements in different browsers
+ */
+ _disableTextSelect: function($elements) {
+ $elements.each(function() {
+ if ($.browser.mozilla) {//Firefox
+ $(this).css('MozUserSelect', 'none');
+ } else if ($.browser.msie) {//IE
+ $(this).bind('selectstart', function() {
+ return false;
+ });
+ } else {//Opera, etc.
+ $(this).mousedown(function() {
+ return false;
+ });
+ }
+ });
+ },
+
+ /*
+ * returns the date on the first millisecond of the week
+ */
+ _dateFirstDayOfWeek: function(date) {
+ var self = this;
+ var midnightCurrentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ var adjustedDate = new Date(midnightCurrentDate);
+ adjustedDate.setDate(adjustedDate.getDate() - self._getAdjustedDayIndex(midnightCurrentDate));
+
+ return adjustedDate;
+ },
+
+ /*
+ * returns the date on the first millisecond of the last day of the week
+ */
+ _dateLastDayOfWeek: function(date) {
+ var self = this;
+ var midnightCurrentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ var adjustedDate = new Date(midnightCurrentDate);
+ var daysToAdd = (self.options.daysToShow - 1 - self._getAdjustedDayIndex(midnightCurrentDate));
+ adjustedDate.setDate(adjustedDate.getDate() + daysToAdd);
+
+ return adjustedDate;
+ },
+
+ /**
+ * fix the date if it is not within given options
+ * minDate and maxDate
+ */
+ _fixMinMaxDate: function(date) {
+ var minDate, maxDate;
+ date = this._cleanDate(date);
+
+ // not less than minDate
+ if (this.options.minDate) {
+ minDate = this._cleanDate(this.options.minDate);
+ // midnight on minDate
+ minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
+ if (date.getTime() < minDate.getTime()) {
+ this._trigger('reachedmindate', this.element, date);
+ }
+ date = this._cleanDate(Math.max(date.getTime(), minDate.getTime()));
+ }
+
+ // not more than maxDate
+ if (this.options.maxDate) {
+ maxDate = this._cleanDate(this.options.maxDate);
+ // apply correction for max date if not startOnFirstDayOfWeek
+ // to make sure no further date is displayed.
+ // otherwise, the complement will still be shown
+ if (!this._startOnFirstDayOfWeek()) {
+ var day = maxDate.getDate() - this.options.daysToShow + 1;
+ maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), day);
+ }
+ // microsecond before midnight on maxDate
+ maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
+ if (date.getTime() > maxDate.getTime()) {
+ this._trigger('reachedmaxdate', this.element, date);
+ }
+ date = this._cleanDate(Math.min(date.getTime(), maxDate.getTime()));
+ }
+
+ return date;
+ },
+
+ /*
+ * gets the index of the current day adjusted based on options
+ */
+ _getAdjustedDayIndex: function(date) {
+ if (!this._startOnFirstDayOfWeek()) {
+ return 0;
+ }
+
+ var midnightCurrentDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ var currentDayOfStandardWeek = midnightCurrentDate.getDay();
+ var days = [0, 1, 2, 3, 4, 5, 6];
+ this._rotate(days, this._firstDayOfWeek());
+ return days[currentDayOfStandardWeek];
+ },
+
+ _firstDayOfWeek: function() {
+ if ($.isFunction(this.options.firstDayOfWeek)) {
+ return this.options.firstDayOfWeek(this.element);
+ }
+ return this.options.firstDayOfWeek;
+ },
+
+ /*
+ * returns the date on the last millisecond of the week
+ */
+ _dateLastMilliOfWeek: function(date) {
+ var lastDayOfWeek = this._dateLastDayOfWeek(date);
+ lastDayOfWeek = this._cloneDate(lastDayOfWeek);
+ lastDayOfWeek.setDate(lastDayOfWeek.getDate() + 1);
+ return lastDayOfWeek;
+
+ },
+
+ /*
+ * Clear the time components of a date leaving the date
+ * of the first milli of day
+ */
+ _clearTime: function(d) {
+ d.setHours(0);
+ d.setMinutes(0);
+ d.setSeconds(0);
+ d.setMilliseconds(0);
+ return d;
+ },
+
+ /*
+ * add specific number of days to date
+ */
+ _addDays: function(d, n, keepTime) {
+ d.setDate(d.getDate() + n);
+ if (keepTime) {
+ return d;
+ }
+ return this._clearTime(d);
+ },
+
+ /*
+ * Rotate an array by specified number of places.
+ */
+ _rotate: function(a /*array*/, p /* integer, positive integer rotate to the right, negative to the left... */) {
+ for (var l = a.length, p = (Math.abs(p) >= l && (p %= l), p < 0 && (p += l), p), i, x; p; p = (Math.ceil(l / p) - 1) * p - l + (l = p)) {
+ for (i = l; i > p; x = a[--i], a[i] = a[i - p], a[i - p] = x) {}
+ }
+ return a;
+ },
+
+ _cloneDate: function(d) {
+ return new Date(d.getTime());
+ },
+
+ /**
+ * Return a Date instance for different representations.
+ * Valid representations are:
+ * * timestamps
+ * * Date objects
+ * * textual representations (only these accepted by the Date
+ * constructor)
+ *
+ * @return {Date} The clean date object.
+ */
+ _cleanDate: function(d) {
+ if (typeof d === 'string') {
+ // if is numeric
+ if (!isNaN(Number(d))) {
+ return this._cleanDate(parseInt(d, 10));
+ }
+
+ // this is a human readable date
+ return Date.parse(d) || new Date(d);
+ }
+
+ if (typeof d == 'number') {
+ return new Date(d);
+ }
+
+ return d;
+ },
+
+ /*
+ * date formatting is adapted from
+ * http://jacwright.com/projects/javascript/date_format
+ */
+ _formatDate: function(date, format) {
+ var returnStr = '';
+ for (var i = 0; i < format.length; i++) {
+ var curChar = format.charAt(i);
+ if (i != 0 && format.charAt(i - 1) == '\\') {
+ returnStr += curChar;
+ }
+ else if (this._replaceChars[curChar]) {
+ returnStr += this._replaceChars[curChar](date, this);
+ } else if (curChar != '\\') {
+ returnStr += curChar;
+ }
+ }
+ return returnStr;
+ },
+
+ _replaceChars: {
+ // Day
+ d: function(date) { return (date.getDate() < 10 ? '0' : '') + date.getDate(); },
+ D: function(date, calendar) { return calendar.options.shortDays[date.getDay()]; },
+ j: function(date) { return date.getDate(); },
+ l: function(date, calendar) { return calendar.options.longDays[date.getDay()]; },
+ N: function(date) { var _d = date.getDay(); return _d ? _d : 7; },
+ S: function(date) { return (date.getDate() % 10 == 1 && date.getDate() != 11 ? 'st' : (date.getDate() % 10 == 2 && date.getDate() != 12 ? 'nd' : (date.getDate() % 10 == 3 && date.getDate() != 13 ? 'rd' : 'th'))); },
+ w: function(date) { return date.getDay(); },
+ z: function(date) { var d = new Date(date.getFullYear(), 0, 1); return Math.ceil((date - d) / 86400000); }, // Fixed now
+ // Week
+ W: function(date) { var d = new Date(date.getFullYear(), 0, 1); return Math.ceil((((date - d) / 86400000) + d.getDay() + 1) / 7); }, // Fixed now
+ // Month
+ F: function(date, calendar) { return calendar.options.longMonths[date.getMonth()]; },
+ m: function(date) { return (date.getMonth() < 9 ? '0' : '') + (date.getMonth() + 1); },
+ M: function(date, calendar) { return calendar.options.shortMonths[date.getMonth()]; },
+ n: function(date) { return date.getMonth() + 1; },
+ t: function(date) { var d = date; return new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate() }, // Fixed now, gets #days of date
+ // Year
+ L: function(date) { var year = date.getFullYear(); return (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)); }, // Fixed now
+ o: function(date) { var d = new Date(date.valueOf()); d.setDate(d.getDate() - ((date.getDay() + 6) % 7) + 3); return d.getFullYear();}, //Fixed now
+ Y: function(date) { return date.getFullYear(); },
+ y: function(date) { return ('' + date.getFullYear()).substr(2); },
+ // Time
+ a: function(date) { return date.getHours() < 12 ? 'am' : 'pm'; },
+ A: function(date) { return date.getHours() < 12 ? 'AM' : 'PM'; },
+ B: function(date) { return Math.floor((((date.getUTCHours() + 1) % 24) + date.getUTCMinutes() / 60 + date.getUTCSeconds() / 3600) * 1000 / 24); }, // Fixed now
+ g: function(date) { return date.getHours() % 12 || 12; },
+ G: function(date) { return date.getHours(); },
+ h: function(date) { return ((date.getHours() % 12 || 12) < 10 ? '0' : '') + (date.getHours() % 12 || 12); },
+ H: function(date) { return (date.getHours() < 10 ? '0' : '') + date.getHours(); },
+ i: function(date) { return (date.getMinutes() < 10 ? '0' : '') + date.getMinutes(); },
+ s: function(date) { return (date.getSeconds() < 10 ? '0' : '') + date.getSeconds(); },
+ u: function(date) { var m = date.getMilliseconds(); return (m < 10 ? '00' : (m < 100 ? '0' : '')) + m; },
+ // Timezone
+ e: function(date) { return 'Not Yet Supported'; },
+ I: function(date) { return 'Not Yet Supported'; },
+ O: function(date) { return (-date.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(date.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(date.getTimezoneOffset() / 60)) + '00'; },
+ P: function(date) { return (-date.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(date.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(date.getTimezoneOffset() / 60)) + ':00'; }, // Fixed now
+ T: function(date) { var m = date.getMonth(); date.setMonth(0); var result = date.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); date.setMonth(m); return result;},
+ Z: function(date) { return -date.getTimezoneOffset() * 60; },
+ // Full Date/Time
+ c: function(date, calendar) { return calendar._formatDate(date, 'Y-m-d\\TH:i:sP'); }, // Fixed now
+ r: function(date, calendar) { return calendar._formatDate(date, 'D, d M Y H:i:s O'); },
+ U: function(date) { return date.getTime() / 1000; }
+ },
+
+ /* USER MANAGEMENT FUNCTIONS */
+
+ getUserForId: function(id) {
+ return $.extend({}, this.options.users[this._getUserIndexFromId(id)]);
+ },
+
+ /**
+ * return the user name for header
+ */
+ _getUserName: function(index) {
+ var self = this;
+ var options = this.options;
+ var user = options.users[index];
+ if ($.isFunction(options.getUserName)) {
+ return options.getUserName(user, index, self.element);
+ }
+ else {
+ return user;
+ }
+ },
+ /**
+ * return the user id for given index
+ */
+ _getUserIdFromIndex: function(index) {
+ var self = this;
+ var options = this.options;
+ if ($.isFunction(options.getUserId)) {
+ return options.getUserId(options.users[index], index, self.element);
+ }
+ return index;
+ },
+ /**
+ * returns the associated user index for given ID
+ */
+ _getUserIndexFromId: function(id) {
+ var self = this;
+ var options = this.options;
+ for (var i = 0; i < options.users.length; i++) {
+ if (self._getUserIdFromIndex(i) == id) {
+ return i;
+ }
+ }
+ return 0;
+ },
+ /**
+ * return the user ids for given calEvent.
+ * default is calEvent.userId field.
+ */
+ _getEventUserId: function(calEvent) {
+ var self = this;
+ var options = this.options;
+ if (options.showAsSeparateUsers && options.users && options.users.length) {
+ if ($.isFunction(options.getEventUserId)) {
+ return options.getEventUserId(calEvent, self.element);
+ }
+ return calEvent.userId;
+ }
+ return [];
+ },
+ /**
+ * sets the event user id on given calEvent
+ * default is calEvent.userId field.
+ */
+ _setEventUserId: function(calEvent, userId) {
+ var self = this;
+ var options = this.options;
+ if ($.isFunction(options.setEventUserId)) {
+ return options.setEventUserId(userId, calEvent, self.element);
+ }
+ calEvent.userId = userId;
+ return calEvent;
+ },
+ /**
+ * return the user ids for given freeBusy.
+ * default is freeBusy.userId field.
+ */
+ _getFreeBusyUserId: function(freeBusy) {
+ var self = this;
+ var options = this.options;
+ if ($.isFunction(options.getFreeBusyUserId)) {
+ return options.getFreeBusyUserId(freeBusy.getOption(), self.element);
+ }
+ return freeBusy.getOption('userId');
+ },
+
+ /* FREEBUSY MANAGEMENT */
+
+ /**
+ * ckean the free busy managers and remove all the freeBusy
+ */
+ _clearFreeBusys: function() {
+ if (this.options.displayFreeBusys) {
+ var self = this,
+ options = this.options,
+ $freeBusyPlaceholders = self.element.find('.wc-grid-row-freebusy .wc-column-freebusy');
+ $freeBusyPlaceholders.each(function() {
+ $(this).data('wcFreeBusyManager', new FreeBusyManager({
+ start: self._cloneDate($(this).data('startDate')),
+ end: self._cloneDate($(this).data('endDate')),
+ defaultFreeBusy: options.defaultFreeBusy || {}
+ }));
+ });
+ self.element.find('.wc-grid-row-freebusy .wc-freebusy').remove();
+ }
+ },
+ /**
+ * retrieve placeholders for given freebusy
+ */
+ _findWeekDaysForFreeBusy: function(freeBusy, $weekDays) {
+ var $returnWeekDays,
+ options = this.options,
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ self = this,
+ userList = self._getFreeBusyUserId(freeBusy);
+ if (!$.isArray(userList)) {
+ userList = userList != 'undefined' ? [userList] : [];
+ }
+ if (!$weekDays) {
+ $weekDays = self.element.find('.wc-grid-row-freebusy .wc-column-freebusy');
+ }
+ $weekDays.each(function() {
+ var manager = $(this).data('wcFreeBusyManager'),
+ has_overlap = manager.isWithin(freeBusy.getStart()) ||
+ manager.isWithin(freeBusy.getEnd()) ||
+ freeBusy.isWithin(manager.getStart()) ||
+ freeBusy.isWithin(manager.getEnd()),
+ userId = $(this).data('wcUserId');
+ if (has_overlap && (!showAsSeparatedUser || ($.inArray(userId, userList) != -1))) {
+ $returnWeekDays = $returnWeekDays ? $returnWeekDays.add($(this)) : $(this);
+ }
+ });
+ return $returnWeekDays;
+ },
+
+ /**
+ * used to render all freeBusys
+ */
+ _renderFreeBusys: function(freeBusys) {
+ if (this.options.displayFreeBusys) {
+ var self = this,
+ $freeBusyPlaceholders = self.element.find('.wc-grid-row-freebusy .wc-column-freebusy'),
+ freebusysToRender;
+ //insert freebusys to dedicated placeholders freebusy managers
+ if ($.isArray(freeBusys)) {
+ freebusysToRender = self._cleanFreeBusys(freeBusys);
+ } else if (freeBusys.freebusys) {
+ freebusysToRender = self._cleanFreeBusys(freeBusys.freebusys);
+ }
+ else {
+ freebusysToRender = [];
+ }
+
+ $.each(freebusysToRender, function(index, freebusy) {
+ var $placeholders = self._findWeekDaysForFreeBusy(freebusy, $freeBusyPlaceholders);
+ if ($placeholders) {
+ $placeholders.each(function() {
+ var manager = $(this).data('wcFreeBusyManager');
+ manager.insertFreeBusy(new FreeBusy(freebusy.getOption()));
+ $(this).data('wcFreeBusyManager', manager);
+ });
+ }
+ });
+
+ //now display freebusys on place holders
+ self._refreshFreeBusys($freeBusyPlaceholders);
+ }
+ },
+ /**
+ * refresh freebusys for given placeholders
+ */
+ _refreshFreeBusys: function($freeBusyPlaceholders) {
+ if (this.options.displayFreeBusys && $freeBusyPlaceholders) {
+ var self = this,
+ options = this.options,
+ start = (options.businessHours.limitDisplay ? options.businessHours.start : 0),
+ end = (options.businessHours.limitDisplay ? options.businessHours.end : 24);
+
+ $freeBusyPlaceholders.each(function() {
+ var $placehoder = $(this);
+ var s = self._cloneDate($placehoder.data('startDate')),
+ e = self._cloneDate(s);
+ s.setHours(start);
+ e.setHours(end);
+ $placehoder.find('.wc-freebusy').remove();
+ $.each($placehoder.data('wcFreeBusyManager').getFreeBusys(s, e), function() {
+ self._renderFreeBusy(this, $placehoder);
+ });
+ });
+ }
+ },
+ /**
+ * render a freebusy item on dedicated placeholders
+ */
+ _renderFreeBusy: function(freeBusy, $freeBusyPlaceholder) {
+ if (this.options.displayFreeBusys) {
+ var self = this,
+ options = this.options,
+ freeBusyHtml = '
';
+
+ var $fb = $(freeBusyHtml);
+ $fb.data('wcFreeBusy', new FreeBusy(freeBusy.getOption()));
+ this._positionFreeBusy($freeBusyPlaceholder, $fb);
+ $fb = options.freeBusyRender(freeBusy.getOption(), $fb, self.element);
+ if ($fb) {
+ $fb.appendTo($freeBusyPlaceholder);
+ }
+ }
+ },
+ /*
+ * Position the freebusy element within the weekday based on it's start / end dates.
+ */
+ _positionFreeBusy: function($placeholder, $freeBusy) {
+ var options = this.options;
+ var freeBusy = $freeBusy.data('wcFreeBusy');
+ var pxPerMillis = $placeholder.height() / options.millisToDisplay;
+ var firstHourDisplayed = options.businessHours.limitDisplay ? options.businessHours.start : 0;
+ var startMillis = freeBusy.getStart().getTime() - new Date(freeBusy.getStart().getFullYear(), freeBusy.getStart().getMonth(), freeBusy.getStart().getDate(), firstHourDisplayed).getTime();
+ var eventMillis = freeBusy.getEnd().getTime() - freeBusy.getStart().getTime();
+ var pxTop = pxPerMillis * startMillis;
+ var pxHeight = pxPerMillis * eventMillis;
+ $freeBusy.css({top: pxTop, height: pxHeight});
+ },
+ /*
+ * Clean freebusys to ensure correct format
+ */
+ _cleanFreeBusys: function(freebusys) {
+ var self = this,
+ freeBusyToReturn = [];
+ if (!$.isArray(freebusys)) {
+ var freebusys = [freebusys];
+ }
+ $.each(freebusys, function(i, freebusy) {
+ freeBusyToReturn.push(new FreeBusy(self._cleanFreeBusy(freebusy)));
+ });
+ return freeBusyToReturn;
+ },
+
+ /*
+ * Clean specific freebusy
+ */
+ _cleanFreeBusy: function(freebusy) {
+ if (freebusy.date) {
+ freebusy.start = freebusy.date;
+ }
+ freebusy.start = this._cleanDate(freebusy.start);
+ freebusy.end = this._cleanDate(freebusy.end);
+ return freebusy;
+ },
+
+ /**
+ * retrives the first freebusy manager matching demand.
+ */
+ getFreeBusyManagersFor: function(date, users) {
+ var calEvent = {
+ start: date,
+ end: date
+ };
+ this._setEventUserId(calEvent, users);
+ return this.getFreeBusyManagerForEvent(calEvent);
+ },
+ /**
+ * retrives the first freebusy manager for given event.
+ */
+ getFreeBusyManagerForEvent: function(newCalEvent) {
+ var self = this,
+ options = this.options,
+ freeBusyManager;
+ if (options.displayFreeBusys) {
+ var $freeBusyPlaceHoders = self.element.find('.wc-grid-row-freebusy .wc-column-freebusy'),
+ freeBusy = new FreeBusy({start: newCalEvent.start, end: newCalEvent.end}),
+ showAsSeparatedUser = options.showAsSeparateUsers && options.users && options.users.length,
+ userId = showAsSeparatedUser ? self._getEventUserId(newCalEvent) : null;
+ if (!$.isArray(userId)) {
+ userId = [userId];
+ }
+ $freeBusyPlaceHoders.each(function() {
+ var manager = $(this).data('wcFreeBusyManager'),
+ has_overlap = manager.isWithin(freeBusy.getEnd()) ||
+ manager.isWithin(freeBusy.getEnd()) ||
+ freeBusy.isWithin(manager.getStart()) ||
+ freeBusy.isWithin(manager.getEnd());
+ if (has_overlap && (!showAsSeparatedUser || $.inArray($(this).data('wcUserId'), userId) != -1)) {
+ freeBusyManager = $(this).data('wcFreeBusyManager');
+ return false;
+ }
+ });
+ }
+ return freeBusyManager;
+ },
+ /**
+ * appends the freebusys to replace the old ones.
+ * @param {array|object} freeBusys freebusy(s) to apply.
+ */
+ updateFreeBusy: function(freeBusys) {
+ var self = this,
+ options = this.options;
+ if (options.displayFreeBusys) {
+ var $toRender,
+ $freeBusyPlaceHoders = self.element.find('.wc-grid-row-freebusy .wc-column-freebusy'),
+ _freeBusys = self._cleanFreeBusys(freeBusys);
+
+ $.each(_freeBusys, function(index, _freeBusy) {
+
+ var $weekdays = self._findWeekDaysForFreeBusy(_freeBusy, $freeBusyPlaceHoders);
+ //if freebusy has a placeholder
+ if ($weekdays && $weekdays.length) {
+ $weekdays.each(function(index, day) {
+ var manager = $(day).data('wcFreeBusyManager');
+ manager.insertFreeBusy(_freeBusy);
+ $(day).data('wcFreeBusyManager', manager);
+ });
+ $toRender = $toRender ? $toRender.add($weekdays) : $weekdays;
+ }
+ });
+ self._refreshFreeBusys($toRender);
+ }
+ },
+
+ /* NEW OPTIONS MANAGEMENT */
+
+ /**
+ * checks wether or not the calendar should be displayed starting on first day of week
+ */
+ _startOnFirstDayOfWeek: function() {
+ return jQuery.isFunction(this.options.startOnFirstDayOfWeek) ? this.options.startOnFirstDayOfWeek(this.element) : this.options.startOnFirstDayOfWeek;
+ },
+
+ /**
+ * finds out the current scroll to apply it when changing the view
+ */
+ _getCurrentScrollHour: function() {
+ var self = this;
+ var options = this.options;
+ var $scrollable = this.element.find('.wc-scrollable-grid');
+ var scroll = $scrollable.scrollTop();
+ if (self.options.businessHours.limitDisplay) {
+ scroll = scroll + options.businessHours.start * options.timeslotHeight * options.timeslotsPerHour;
+ }
+ return Math.round(scroll / (options.timeslotHeight * options.timeslotsPerHour)) + 1;
+ },
+ _getJsonOptions: function() {
+ if ($.isFunction(this.options.jsonOptions)) {
+ return $.extend({}, this.options.jsonOptions(this.element));
+ }
+ if ($.isPlainObject(this.options.jsonOptions)) {
+ return $.extend({}, this.options.jsonOptions);
+ }
+ return {};
+ },
+ _getHeaderDate: function(date) {
+ var options = this.options;
+ if (options.getHeaderDate && $.isFunction(options.getHeaderDate))
+ {
+ return options.getHeaderDate(date, this.element);
+ }
+ var dayName = options.useShortDayNames ? options.shortDays[date.getDay()] : options.longDays[date.getDay()];
+ return dayName + (options.headerSeparator) + this._formatDate(date, options.dateFormat);
+ },
+
+
+
+ /**
+ * returns corrected date related to DST problem
+ */
+ _getDSTdayShift: function(date, shift) {
+ var start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0);
+ var offset1 = start.getTimezoneOffset();
+ var offset2 = date.getTimezoneOffset();
+ if (offset1 == offset2)
+ return date;
+ shift = shift ? shift : 1;
+ return new Date(date.getTime() - shift * (offset1 > offset2 ? -1 : 1) * (Math.max(offset1, offset2) - Math.min(offset1, offset2)) * 60000);
+ },
+ _needDSTdayShift: function(date1, date2) {
+ return date1.getTimezoneOffset() != date2.getTimezoneOffset();
+ }
+
+
+
+ }; // end of widget function return
+ })() //end of widget function closure execution
+ ); // end of $.widget("ui.weekCalendar"...
+
+ $.extend($.ui.weekCalendar, {
+ version: '2.0-dev',
+ updateLayoutOptions: {
+ startOnFirstDayOfWeek: true,
+ firstDayOfWeek: true,
+ daysToShow: true,
+ displayOddEven: true,
+ timeFormat: true,
+ dateFormat: true,
+ use24Hour: true,
+ useShortDayNames: true,
+ businessHours: true,
+ timeslotHeight: true,
+ timeslotsPerHour: true,
+ buttonText: true,
+ height: true,
+ shortMonths: true,
+ longMonths: true,
+ shortDays: true,
+ longDays: true,
+ textSize: true,
+ users: true,
+ showAsSeparateUsers: true,
+ displayFreeBusys: true
+ }
+ });
+
+ var MILLIS_IN_DAY = 86400000;
+ var MILLIS_IN_WEEK = MILLIS_IN_DAY * 7;
+
+ /* FREE BUSY MANAGERS */
+ var FreeBusyProto = {
+ getStart: function() {return this.getOption('start')},
+ getEnd: function() {return this.getOption('end')},
+ getOption: function() {
+ if (!arguments.length) { return this.options }
+ if (typeof(this.options[arguments[0]]) !== 'undefined') {
+ return this.options[arguments[0]];
+ }
+ else if (typeof(arguments[1]) !== 'undefined') {
+ return arguments[1];
+ }
+ return null;
+ },
+ setOption: function(key, value) {
+ if (arguments.length == 1) {
+ $.extend(this.options, arguments[0]);
+ return this;
+ }
+ this.options[key] = value;
+ return this;
+ },
+ isWithin: function(dateTime) {return Math.floor(dateTime.getTime() / 1000) >= Math.floor(this.getStart().getTime() / 1000) && Math.floor(dateTime.getTime() / 1000) <= Math.floor(this.getEnd().getTime() / 1000)},
+ isValid: function() {return this.getStart().getTime() < this.getEnd().getTime()}
+ };
+
+ /**
+ * @constructor
+ * single user freebusy manager.
+ */
+ var FreeBusy = function(options) {
+ this.options = $.extend({}, options || {});
+ };
+ $.extend(FreeBusy.prototype, FreeBusyProto);
+
+ var FreeBusyManager = function(options) {
+ this.options = $.extend({
+ defaultFreeBusy: {}
+ }, options || {});
+ this.freeBusys = [];
+ this.freeBusys.push(new FreeBusy($.extend({
+ start: this.getStart(),
+ end: this.getEnd()
+ }, this.options.defaultFreeBusy)));
+ };
+ $.extend(FreeBusyManager.prototype, FreeBusyProto, {
+ /**
+ * return matching freeBusys.
+ * if you do not pass any argument, returns all freebusys.
+ * if you only pass a start date, only matchinf freebusy will be returned.
+ * if you pass 2 arguments, then all freebusys available within the time period will be returned
+ * @param {Date} start [optionnal] if you do not pass end date, will return the freeBusy within which this date falls.
+ * @param {Date} end [optionnal] the date where to stop the search.
+ * @return {Array} an array of FreeBusy matching arguments.
+ */
+ getFreeBusys: function() {
+ switch (arguments.length) {
+ case 0:
+ return this.freeBusys;
+ case 1:
+ var freeBusy = [];
+ var start = arguments[0];
+ if (!this.isWithin(start)) {
+ return freeBusy;
+ }
+ $.each(this.freeBusys, function() {
+ if (this.isWithin(start)) {
+ freeBusy.push(this);
+ }
+ if (Math.floor(this.getEnd().getTime() / 1000) > Math.floor(start.getTime() / 1000)) {
+ return false;
+ }
+ });
+ return freeBusy;
+ default:
+ //we assume only 2 first args are revealants
+ var freeBusy = [];
+ var start = arguments[0], end = arguments[1];
+ var tmpFreeBusy = new FreeBusy({start: start, end: end});
+ if (end.getTime() < start.getTime() || this.getStart().getTime() > end.getTime() || this.getEnd().getTime() < start.getTime()) {
+ return freeBusy;
+ }
+ $.each(this.freeBusys, function() {
+ if (this.getStart().getTime() >= end.getTime()) {
+ return false;
+ }
+ if (tmpFreeBusy.isWithin(this.getStart()) && tmpFreeBusy.isWithin(this.getEnd())) {
+ freeBusy.push(this);
+ }
+ else if (this.isWithin(tmpFreeBusy.getStart()) && this.isWithin(tmpFreeBusy.getEnd())) {
+ var _f = new FreeBusy(this.getOption());
+ _f.setOption('end', tmpFreeBusy.getEnd());
+ _f.setOption('start', tmpFreeBusy.getStart());
+ freeBusy.push(_f);
+ }
+ else if (this.isWithin(tmpFreeBusy.getStart()) && this.getStart().getTime() < start.getTime()) {
+ var _f = new FreeBusy(this.getOption());
+ _f.setOption('start', tmpFreeBusy.getStart());
+ freeBusy.push(_f);
+ }
+ else if (this.isWithin(tmpFreeBusy.getEnd()) && this.getEnd().getTime() > end.getTime()) {
+ var _f = new FreeBusy(this.getOption());
+ _f.setOption('end', tmpFreeBusy.getEnd());
+ freeBusy.push(_f);
+ }
+ });
+ return freeBusy;
+ }
+ },
+ insertFreeBusy: function(freeBusy) {
+ var freeBusy = new FreeBusy(freeBusy.getOption());
+ //first, if inserted freebusy is bigger than manager
+ if (freeBusy.getStart().getTime() < this.getStart().getTime()) {
+ freeBusy.setOption('start', this.getStart());
+ }
+ if (freeBusy.getEnd().getTime() > this.getEnd().getTime()) {
+ freeBusy.setOption('end', this.getEnd());
+ }
+ var start = freeBusy.getStart(), end = freeBusy.getEnd(),
+ startIndex = 0, endIndex = this.freeBusys.length - 1,
+ newFreeBusys = [];
+ var pushNewFreeBusy = function(_f) {if (_f.isValid()) newFreeBusys.push(_f);};
+
+ $.each(this.freeBusys, function(index) {
+ //within the loop, we have following vars:
+ // curFreeBusyItem: the current iteration freeBusy, part of manager freeBusys list
+ // start: the insterted freeBusy start
+ // end: the inserted freebusy end
+ var curFreeBusyItem = this;
+ if (curFreeBusyItem.isWithin(start) && curFreeBusyItem.isWithin(end)) {
+ /*
+ we are in case where inserted freebusy fits in curFreeBusyItem:
+ curFreeBusyItem: *-----------------------------*
+ freeBusy: *-------------*
+ obviously, start and end indexes are this item.
+ */
+ startIndex = index;
+ endIndex = index;
+ if (start.getTime() == curFreeBusyItem.getStart().getTime() && end.getTime() == curFreeBusyItem.getEnd().getTime()) {
+ /*
+ in this case, inserted freebusy is exactly curFreeBusyItem:
+ curFreeBusyItem: *-----------------------------*
+ freeBusy: *-----------------------------*
+
+ just replace curFreeBusyItem with freeBusy.
+ */
+ var _f1 = new FreeBusy(freeBusy.getOption());
+ pushNewFreeBusy(_f1);
+ }
+ else if (start.getTime() == curFreeBusyItem.getStart().getTime()) {
+ /*
+ in this case inserted freebusy starts with curFreeBusyItem:
+ curFreeBusyItem: *-----------------------------*
+ freeBusy: *--------------*
+
+ just replace curFreeBusyItem with freeBusy AND the rest.
+ */
+ var _f1 = new FreeBusy(freeBusy.getOption());
+ var _f2 = new FreeBusy(curFreeBusyItem.getOption());
+ _f2.setOption('start', end);
+ pushNewFreeBusy(_f1);
+ pushNewFreeBusy(_f2);
+ }
+ else if (end.getTime() == curFreeBusyItem.getEnd().getTime()) {
+ /*
+ in this case inserted freebusy ends with curFreeBusyItem:
+ curFreeBusyItem: *-----------------------------*
+ freeBusy: *--------------*
+
+ just replace curFreeBusyItem with before part AND freeBusy.
+ */
+ var _f1 = new FreeBusy(curFreeBusyItem.getOption());
+ _f1.setOption('end', start);
+ var _f2 = new FreeBusy(freeBusy.getOption());
+ pushNewFreeBusy(_f1);
+ pushNewFreeBusy(_f2);
+ }
+ else {
+ /*
+ in this case inserted freebusy is within curFreeBusyItem:
+ curFreeBusyItem: *-----------------------------*
+ freeBusy: *--------------*
+
+ just replace curFreeBusyItem with before part AND freeBusy AND the rest.
+ */
+ var _f1 = new FreeBusy(curFreeBusyItem.getOption());
+ var _f2 = new FreeBusy(freeBusy.getOption());
+ var _f3 = new FreeBusy(curFreeBusyItem.getOption());
+ _f1.setOption('end', start);
+ _f3.setOption('start', end);
+ pushNewFreeBusy(_f1);
+ pushNewFreeBusy(_f2);
+ pushNewFreeBusy(_f3);
+ }
+ /*
+ as work is done, no need to go further.
+ return false
+ */
+ return false;
+ }
+ else if (curFreeBusyItem.isWithin(start) && curFreeBusyItem.getEnd().getTime() != start.getTime()) {
+ /*
+ in this case, inserted freebusy starts within curFreeBusyItem:
+ curFreeBusyItem: *----------*
+ freeBusy: *-------------------*
+
+ set start index AND insert before part, we'll insert freebusy later
+ */
+ if (curFreeBusyItem.getStart().getTime() != start.getTime()) {
+ var _f1 = new FreeBusy(curFreeBusyItem.getOption());
+ _f1.setOption('end', start);
+ pushNewFreeBusy(_f1);
+ }
+ startIndex = index;
+ }
+ else if (curFreeBusyItem.isWithin(end) && curFreeBusyItem.getStart().getTime() != end.getTime()) {
+ /*
+ in this case, inserted freebusy starts within curFreeBusyItem:
+ curFreeBusyItem: *----------*
+ freeBusy: *-------------------*
+
+ set end index AND insert freebusy AND insert after part if needed
+ */
+ pushNewFreeBusy(new FreeBusy(freeBusy.getOption()));
+ if (end.getTime() < curFreeBusyItem.getEnd().getTime()) {
+ var _f1 = new FreeBusy(curFreeBusyItem.getOption());
+ _f1.setOption('start', end);
+ pushNewFreeBusy(_f1);
+ }
+ endIndex = index;
+ return false;
+ }
+ });
+ //now compute arguments
+ var tmpFB = this.freeBusys;
+ this.freeBusys = [];
+
+ if (startIndex) {
+ this.freeBusys = this.freeBusys.concat(tmpFB.slice(0, startIndex));
+ }
+ this.freeBusys = this.freeBusys.concat(newFreeBusys);
+ if (endIndex < tmpFB.length) {
+ this.freeBusys = this.freeBusys.concat(tmpFB.slice(endIndex + 1));
+ }
+/* if(start.getDate() == 1){
+ console.info('insert from '+freeBusy.getStart() +' to '+freeBusy.getEnd());
+ console.log('index from '+ startIndex + ' to ' + endIndex);
+ var str = [];
+ $.each(tmpFB, function(i){str.push(i + ": " + this.getStart().getHours() + ' > ' + this.getEnd().getHours() + ' ' + (this.getOption('free') ? 'free' : 'busy'))});
+ console.log(str.join('\n'));
+
+ console.log('insert');
+ var str = [];
+ $.each(newFreeBusys, function(i){str.push(this.getStart().getHours() + ' > ' + this.getEnd().getHours())});
+ console.log(str.join(', '));
+
+ console.log('results');
+ var str = [];
+ $.each(this.freeBusys, function(i){str.push(i + ": " + this.getStart().getHours() + ' > ' + this.getEnd().getHours() + ' ' + (this.getOption('free') ? 'free' :'busy'))});
+ console.log(str.join('\n'));
+ }*/
+ return this;
+ }
+ });
+
+})(jQuery);
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100755
index 00000000..5b5dab2a
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
new file mode 100755
index 00000000..ac8b229a
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100755
index 00000000..ad3d6346
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100755
index 00000000..42ccba26
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100755
index 00000000..5a46b47c
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
new file mode 100755
index 00000000..86c2baa6
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
new file mode 100755
index 00000000..4443fdc1
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
new file mode 100755
index 00000000..7c9fa6c6
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_222222_256x240.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_222222_256x240.png
new file mode 100755
index 00000000..b273ff11
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_222222_256x240.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_2e83ff_256x240.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_2e83ff_256x240.png
new file mode 100755
index 00000000..09d1cdc8
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_2e83ff_256x240.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_454545_256x240.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_454545_256x240.png
new file mode 100755
index 00000000..59bd45b9
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_454545_256x240.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_888888_256x240.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_888888_256x240.png
new file mode 100755
index 00000000..6d02426c
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_888888_256x240.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_cd0a0a_256x240.png b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_cd0a0a_256x240.png
new file mode 100755
index 00000000..2ab019b7
Binary files /dev/null and b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/images/ui-icons_cd0a0a_256x240.png differ
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/jquery-ui-1.8.11.custom.css b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/jquery-ui-1.8.11.custom.css
new file mode 100755
index 00000000..b2f72e97
--- /dev/null
+++ b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/css/smoothness/jquery-ui-1.8.11.custom.css
@@ -0,0 +1,573 @@
+/*
+ * jQuery UI CSS Framework 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+
+
+/*
+ * jQuery UI CSS Framework 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Theming/API
+ *
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
+ */
+
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+.ui-widget :active { outline: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-off { background-position: -96px -144px; }
+.ui-icon-radio-on { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
+ * jQuery UI Resizable 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Resizable#theming
+ */
+.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/*
+ * jQuery UI Selectable 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Selectable#theming
+ */
+.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+/*
+ * jQuery UI Accordion 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Accordion#theming
+ */
+/* IE/Win - Fix animation bug - #4615 */
+.ui-accordion { width: 100%; }
+.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }
+.ui-accordion .ui-accordion-li-fix { display: inline; }
+.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }
+.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }
+.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }
+.ui-accordion .ui-accordion-content-active { display: block; }
+/*
+ * jQuery UI Autocomplete 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Autocomplete#theming
+ */
+.ui-autocomplete { position: absolute; cursor: default; }
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+
+/*
+ * jQuery UI Menu 1.8.11
+ *
+ * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menu#theming
+ */
+.ui-menu {
+ list-style:none;
+ padding: 2px;
+ margin: 0;
+ display:block;
+ float: left;
+}
+.ui-menu .ui-menu {
+ margin-top: -3px;
+}
+.ui-menu .ui-menu-item {
+ margin:0;
+ padding: 0;
+ zoom: 1;
+ float: left;
+ clear: left;
+ width: 100%;
+}
+.ui-menu .ui-menu-item a {
+ text-decoration:none;
+ display:block;
+ padding:.2em .4em;
+ line-height:1.5;
+ zoom:1;
+}
+.ui-menu .ui-menu-item a.ui-state-hover,
+.ui-menu .ui-menu-item a.ui-state-active {
+ font-weight: normal;
+ margin: -1px;
+}
+/*
+ * jQuery UI Button 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Button#theming
+ */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; }
+button.ui-button-icons-only { width: 3.7em; }
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4; }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+/*
+ * jQuery UI Dialog 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Dialog#theming
+ */
+.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+/*
+ * jQuery UI Slider 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Slider#theming
+ */
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
+ * jQuery UI Tabs 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Tabs#theming
+ */
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tabs .ui-tabs-hide { display: none !important; }
+/*
+ * jQuery UI Datepicker 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Datepicker#theming
+ */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+ display: none; /*sorry for IE5*/
+ display/**/: block; /*sorry for IE5*/
+ position: absolute; /*must have*/
+ z-index: -1; /*must have*/
+ filter: mask(); /*must have*/
+ top: -4px; /*must have*/
+ left: -4px; /*must have*/
+ width: 200px; /*must have*/
+ height: 200px; /*must have*/
+}/*
+ * jQuery UI Progressbar 1.8.11
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Progressbar#theming
+ */
+.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
\ No newline at end of file
diff --git a/modules-available/locationinfo/frontend/jquery-week-calendar/libs/date.js b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/date.js
new file mode 100755
index 00000000..59005e20
--- /dev/null
+++ b/modules-available/locationinfo/frontend/jquery-week-calendar/libs/date.js
@@ -0,0 +1,145 @@
+/**
+ * @version: 1.0 Alpha-1
+ * @author: Coolite Inc. http://www.coolite.com/
+ * @date: 2008-05-13
+ * @copyright: Copyright (c) 2006-2008, Coolite Inc. (http://www.coolite.com/). All rights reserved.
+ * @license: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
+ * @website: http://www.datejs.com/
+ */
+Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|aft(er)?|from|hence)/i,subtract:/^(\-|bef(ore)?|ago)/i,yesterday:/^yes(terday)?/i,today:/^t(od(ay)?)?/i,tomorrow:/^tom(orrow)?/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^mn|min(ute)?s?/i,hour:/^h(our)?s?/i,week:/^w(eek)?s?/i,month:/^m(onth)?s?/i,day:/^d(ay)?s?/i,year:/^y(ear)?s?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a(?!u|p)|p)/i},timezones:[{name:"UTC",offset:"-000"},{name:"GMT",offset:"-000"},{name:"EST",offset:"-0500"},{name:"EDT",offset:"-0400"},{name:"CST",offset:"-0600"},{name:"CDT",offset:"-0500"},{name:"MST",offset:"-0700"},{name:"MDT",offset:"-0600"},{name:"PST",offset:"-0800"},{name:"PDT",offset:"-0700"}]};
+(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo,p=function(s,l){if(!l){l=2;}
+return("000"+s).slice(l*-1);};$P.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};$P.setTimeToNow=function(){var n=new Date();this.setHours(n.getHours());this.setMinutes(n.getMinutes());this.setSeconds(n.getSeconds());this.setMilliseconds(n.getMilliseconds());return this;};$D.today=function(){return new Date().clearTime();};$D.compare=function(date1,date2){if(isNaN(date1)||isNaN(date2)){throw new Error(date1+" - "+date2);}else if(date1 instanceof Date&&date2 instanceof Date){return(date1
date2)?1:0;}else{throw new TypeError(date1+" - "+date2);}};$D.equals=function(date1,date2){return(date1.compareTo(date2)===0);};$D.getDayNumberFromName=function(name){var n=$C.dayNames,m=$C.abbreviatedDayNames,o=$C.shortestDayNames,s=name.toLowerCase();for(var i=0;i=start.getTime()&&this.getTime()<=end.getTime();};$P.isAfter=function(date){return this.compareTo(date||new Date())===1;};$P.isBefore=function(date){return(this.compareTo(date||new Date())===-1);};$P.isToday=function(){return this.isSameDay(new Date());};$P.isSameDay=function(date){return this.clone().clearTime().equals(date.clone().clearTime());};$P.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};$P.addSeconds=function(value){return this.addMilliseconds(value*1000);};$P.addMinutes=function(value){return this.addMilliseconds(value*60000);};$P.addHours=function(value){return this.addMilliseconds(value*3600000);};$P.addDays=function(value){this.setDate(this.getDate()+value);return this;};$P.addWeeks=function(value){return this.addDays(value*7);};$P.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,$D.getDaysInMonth(this.getFullYear(),this.getMonth())));return this;};$P.addYears=function(value){return this.addMonths(value*12);};$P.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
+var x=config;if(x.milliseconds){this.addMilliseconds(x.milliseconds);}
+if(x.seconds){this.addSeconds(x.seconds);}
+if(x.minutes){this.addMinutes(x.minutes);}
+if(x.hours){this.addHours(x.hours);}
+if(x.weeks){this.addWeeks(x.weeks);}
+if(x.months){this.addMonths(x.months);}
+if(x.years){this.addYears(x.years);}
+if(x.days){this.addDays(x.days);}
+return this;};var $y,$m,$d;$P.getWeek=function(){var a,b,c,d,e,f,g,n,s,w;$y=(!$y)?this.getFullYear():$y;$m=(!$m)?this.getMonth()+1:$m;$d=(!$d)?this.getDate():$d;if($m<=2){a=$y-1;b=(a/4|0)-(a/100|0)+(a/400|0);c=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);s=b-c;e=0;f=$d-1+(31*($m-1));}else{a=$y;b=(a/4|0)-(a/100|0)+(a/400|0);c=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);s=b-c;e=s+1;f=$d+((153*($m-3)+2)/5)+58+s;}
+g=(a+b)%7;d=(f+g-e)%7;n=(f+3-d)|0;if(n<0){w=53-((g-s)/5|0);}else if(n>364+s){w=1;}else{w=(n/7|0)+1;}
+$y=$m=$d=null;return w;};$P.getISOWeek=function(){$y=this.getUTCFullYear();$m=this.getUTCMonth()+1;$d=this.getUTCDate();return p(this.getWeek());};$P.setWeek=function(n){return this.moveToDayOfWeek(1).addWeeks(n-this.getWeek());};$D._validate=function(n,min,max,name){if(typeof n=="undefined"){return false;}else if(typeof n!="number"){throw new TypeError(n+" is not a Number.");}else if(nmax){throw new RangeError(n+" is not a valid value for "+name+".");}
+return true;};$D.validateMillisecond=function(value){return $D._validate(value,0,999,"millisecond");};$D.validateSecond=function(value){return $D._validate(value,0,59,"second");};$D.validateMinute=function(value){return $D._validate(value,0,59,"minute");};$D.validateHour=function(value){return $D._validate(value,0,23,"hour");};$D.validateDay=function(value,year,month){return $D._validate(value,1,$D.getDaysInMonth(year,month),"day");};$D.validateMonth=function(value){return $D._validate(value,0,11,"month");};$D.validateYear=function(value){return $D._validate(value,0,9999,"year");};$P.set=function(config){if($D.validateMillisecond(config.millisecond)){this.addMilliseconds(config.millisecond-this.getMilliseconds());}
+if($D.validateSecond(config.second)){this.addSeconds(config.second-this.getSeconds());}
+if($D.validateMinute(config.minute)){this.addMinutes(config.minute-this.getMinutes());}
+if($D.validateHour(config.hour)){this.addHours(config.hour-this.getHours());}
+if($D.validateMonth(config.month)){this.addMonths(config.month-this.getMonth());}
+if($D.validateYear(config.year)){this.addYears(config.year-this.getFullYear());}
+if($D.validateDay(config.day,this.getFullYear(),this.getMonth())){this.addDays(config.day-this.getDate());}
+if(config.timezone){this.setTimezone(config.timezone);}
+if(config.timezoneOffset){this.setTimezoneOffset(config.timezoneOffset);}
+if(config.week&&$D._validate(config.week,0,53,"week")){this.setWeek(config.week);}
+return this;};$P.moveToFirstDayOfMonth=function(){return this.set({day:1});};$P.moveToLastDayOfMonth=function(){return this.set({day:$D.getDaysInMonth(this.getFullYear(),this.getMonth())});};$P.moveToNthOccurrence=function(dayOfWeek,occurrence){var shift=0;if(occurrence>0){shift=occurrence-1;}
+else if(occurrence===-1){this.moveToLastDayOfMonth();if(this.getDay()!==dayOfWeek){this.moveToDayOfWeek(dayOfWeek,-1);}
+return this;}
+return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(dayOfWeek,+1).addWeeks(shift);};$P.moveToDayOfWeek=function(dayOfWeek,orient){var diff=(dayOfWeek-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};$P.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};$P.getOrdinalNumber=function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/86400000)+1;};$P.getTimezone=function(){return $D.getTimezoneAbbreviation(this.getUTCOffset());};$P.setTimezoneOffset=function(offset){var here=this.getTimezoneOffset(),there=Number(offset)*-6/10;return this.addMinutes(there-here);};$P.setTimezone=function(offset){return this.setTimezoneOffset($D.getTimezoneOffset(offset));};$P.hasDaylightSavingTime=function(){return(Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset());};$P.isDaylightSavingTime=function(){return(this.hasDaylightSavingTime()&&new Date().getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset());};$P.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r.charAt(0)+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};$P.getElapsed=function(date){return(date||new Date())-this;};if(!$P.toISOString){$P.toISOString=function(){function f(n){return n<10?'0'+n:n;}
+return'"'+this.getUTCFullYear()+'-'+
+f(this.getUTCMonth()+1)+'-'+
+f(this.getUTCDate())+'T'+
+f(this.getUTCHours())+':'+
+f(this.getUTCMinutes())+':'+
+f(this.getUTCSeconds())+'Z"';};}
+$P._toString=$P.toString;$P.toString=function(format){var x=this;if(format&&format.length==1){var c=$C.formatPatterns;x.t=x.toString;switch(format){case"d":return x.t(c.shortDate);case"D":return x.t(c.longDate);case"F":return x.t(c.fullDateTime);case"m":return x.t(c.monthDay);case"r":return x.t(c.rfc1123);case"s":return x.t(c.sortableDateTime);case"t":return x.t(c.shortTime);case"T":return x.t(c.longTime);case"u":return x.t(c.universalSortableDateTime);case"y":return x.t(c.yearMonth);}}
+var ord=function(n){switch(n*1){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};return format?format.replace(/(\\)?(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|S)/g,function(m){if(m.charAt(0)==="\\"){return m.replace("\\","");}
+x.h=x.getHours;switch(m){case"hh":return p(x.h()<13?(x.h()===0?12:x.h()):(x.h()-12));case"h":return x.h()<13?(x.h()===0?12:x.h()):(x.h()-12);case"HH":return p(x.h());case"H":return x.h();case"mm":return p(x.getMinutes());case"m":return x.getMinutes();case"ss":return p(x.getSeconds());case"s":return x.getSeconds();case"yyyy":return p(x.getFullYear(),4);case"yy":return p(x.getFullYear());case"dddd":return $C.dayNames[x.getDay()];case"ddd":return $C.abbreviatedDayNames[x.getDay()];case"dd":return p(x.getDate());case"d":return x.getDate();case"MMMM":return $C.monthNames[x.getMonth()];case"MMM":return $C.abbreviatedMonthNames[x.getMonth()];case"MM":return p((x.getMonth()+1));case"M":return x.getMonth()+1;case"t":return x.h()<12?$C.amDesignator.substring(0,1):$C.pmDesignator.substring(0,1);case"tt":return x.h()<12?$C.amDesignator:$C.pmDesignator;case"S":return ord(x.getDate());default:return m;}}):this._toString();};}());
+(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo,$N=Number.prototype;$P._orient=+1;$P._nth=null;$P._is=false;$P._same=false;$P._isSecond=false;$N._dateElement="day";$P.next=function(){this._orient=+1;return this;};$D.next=function(){return $D.today().next();};$P.last=$P.prev=$P.previous=function(){this._orient=-1;return this;};$D.last=$D.prev=$D.previous=function(){return $D.today().last();};$P.is=function(){this._is=true;return this;};$P.same=function(){this._same=true;this._isSecond=false;return this;};$P.today=function(){return this.same().day();};$P.weekday=function(){if(this._is){this._is=false;return(!this.is().sat()&&!this.is().sun());}
+return false;};$P.at=function(time){return(typeof time==="string")?$D.parse(this.toString("d")+" "+time):this.set(time);};$N.fromNow=$N.after=function(date){var c={};c[this._dateElement]=this;return((!date)?new Date():date.clone()).add(c);};$N.ago=$N.before=function(date){var c={};c[this._dateElement]=this*-1;return((!date)?new Date():date.clone()).add(c);};var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),pxf=("Milliseconds Seconds Minutes Hours Date Week Month FullYear").split(/\s/),nth=("final first second third fourth fifth").split(/\s/),de;$P.toObject=function(){var o={};for(var i=0;itemp){throw new RangeError($D.getDayName(n)+" does not occur "+ntemp+" times in the month of "+$D.getMonthName(temp.getMonth())+" "+temp.getFullYear()+".");}
+return this;}
+return this.moveToDayOfWeek(n,this._orient);};};var sdf=function(n){return function(){var t=$D.today(),shift=n-t.getDay();if(n===0&&$C.firstDayOfWeek===1&&t.getDay()!==0){shift=shift+7;}
+return t.addDays(shift);};};for(var i=0;i-1;m--){v=px[m].toLowerCase();if(o1[v]!=o2[v]){return false;}
+if(k==v){break;}}
+return true;}
+if(j.substring(j.length-1)!="s"){j+="s";}
+return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
+if(!last&&q[1].length===0){last=true;}
+if(!last){var qx=[];for(var j=0;j0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
+if(rx[1].length1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
+if(args){for(var i=0,px=args.shift();i2)?n:(n+(((n+2000)<$C.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];for(var i=0;i$D.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
+var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
+return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
+for(var i=0;id)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
+"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
+e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
+"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
+C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
+s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
+j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
+toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
+-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
+if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
+b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
+!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
+l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;Ha ";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
+k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
+scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
+false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML=" ";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
+1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="
";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
+"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
+c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
+else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
+if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
+attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
+b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
+c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
+arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
+d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
+c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
+8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
+"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
+d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
+B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
+"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
+0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
+(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
+break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
+q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
+l;g.sort(w);if(h)for(var i=1;i0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
+m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
+true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
+g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return in[3]-0},nth:function(g,i,n){return n[3]-
+0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
+i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
+if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
+g);else if(typeof g.length==="number")for(var p=g.length;n
";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
+n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML=" ";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
+function(){var g=k,i=t.createElement("div");i.innerHTML="
";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
+p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
+t.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
+function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n0)for(var h=d;h0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
+h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
+c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
+2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
+b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
+e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/\s]+\/)>/g,P={option:[1,
+""," "],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
+c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
+wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
+prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
+this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
+return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
+else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1>$2>");try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
+prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
+b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1>$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]===""&&!x?r.childNodes:[];for(o=k.length-
+1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
+d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
+jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
+zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
+h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
+if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
+d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
+e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/