﻿function CalendarMeeting(startDate,endDate,meetingTitle, allDay)
{
    this.startTime = startDate;
    this.endTime = endDate;
    this.meetingName = meetingTitle;
    this.allDay = allDay;
}
CalendarMeeting.prototype.NormalizeDates = function()
{    
    var startDate=this.startDate;
    var endDate=this.endDate;
    var slot = Math.floor(startDate.getMinutes() / 15);
    this.startDate = new Date(this.startDate.getFullYear(),this.startDate.getMonth(), this.startDate.getDate(),this.startDate.getHours(), slot * 15, 0);
    slot = Math.ceil(startDate.getMinutes() / 15);
    if(slot == 4)
    {
        this.endDate = new Date(this.endDate.getFullYear(),this.endDate.getFullMonth(),this.endDate.getDate(),this.endDate.getHours() , 0, 0);
        this.endDate.setHours(this.endDate.getHours()+1);
    }
    else
    {
        this.endDate = new Date(this.endDate.getFullYear(),this.endDate.getFullMonth(),this.endDate.getDate(),this.endDate.getHours() , slot * 15, 0);
    }
}


function sortByDate(a,b)
{
    var x = a.startTime;
    var y = b.startTime;
    return ((x<y) ? -1 : ((x > y) ? 1 : 0));
}
