﻿/// <reference path="../jQuery/jquery-1.3.2.js" />

var EventCalendarJSON;

TelerikCalendar = function(parentDivID) {
this.init(parentDivID);
}

$.extend(TelerikCalendar.prototype,
{
    // object variables
    m_parentDivID: "",
    m_accountID: GetCurrentUserAccountID(),
    m_bOwnerView: true,

    init: function(parentDivID) {
        if (this.m_accountID != GetTargetUserAccountID()) {
            this.m_accountID = GetTargetUserAccountID();
            this.m_bOwnerView = false;
        }
        // Init value
        this.m_parentDivID = parentDivID;
    },
    GetEventCalendar: function(y, m) {
        var jData = new Object();

        jData.accountID = this.m_accountID;
        jData.includeBirthday = true;
        jData.isShowAll = this.m_bOwnerView;
        jData.startDate = new Date(y, parseInt(m - 1), 1);
        jData.endDate = new Date(y, parseInt(m + 2), 1);
        jData.pageNumber = 1;
        jData.itemPerPage = 100;

        SendAjax(GetURL("Calendar/WebService/EventCalendarWebService.asmx") + "/GetAppointmentsByDate", jData, this.onGetEventCalendarComplete, false);
    },
    onGetEventCalendarComplete: function(data) {
        if (null != data || undefined != data) {
            EventCalendarJSON = data.result;
        }
    },
    toString: function() {
        return 'TelerikCalendar';
    }
});
