(function ($)
{
    /* ------------------------------- */
    $(function ()
    {

        // カレンダー
        // 現在の年月取得
        // nowSysDate = new Date();
        // var year = nowSysDate.getYear();
        // // 年
        // if (year < 2000) {
        //     year += 1900;
        // }
        // var month = eval(nowSysDate.getMonth()) + 1 // 月
        // getCal(year, month);
        // // news 5件
        // $.ajax(
        // {
        //     'url' : 'news/index.cgi', 'data' : {
        //         c : 'top'
        //     },
        //     'type' : 'post',
        //     success : function (data)
        //     {
        //         $('#news_list').html(data);
        //         // フェードイン
        //         setFadein('news_list');
        //     }
        // });


        // NEWS 5件
        $.ajax(
        {
            'url' : './cgi-local/news/index.cgi',
            'data' : {
                c : 'top_news'
            },
            'type' : 'post',
            success : function (data)
            {
                 $('#news_list').html(data);
            }
        });

        // EVENT 5件
        $.ajax(
        {
            'url' : './cgi-local/news/index.cgi',
            'data' : {
                c : 'top_event'
            },
            'type' : 'post',
            success : function (data)
            {
                $('#event_list').html(data);
            }
        });
    });
})(jQuery);


// ----------------------------
// カレンダー取得処理
// ----------------------------
var getCal = function (yy, mm)
{
    // formにセット
    $('#cal_yy').val(yy);
    $('#cal_mm').val(mm);
    // 送信
    var param = $("#calForm").serialize();
    $.ajax(
    {
        'url' : 'cal.cgi', 'type' : 'post', 'data' : param,
        success : function (data)
        {
            $('div#cal').html(data);
            $('a.setCal').click(getCalMonth);
        }
    });
}

// 月送り処理
var getCalMonth = function ()
{
    var yy = $(this).attr('yy');
    var mm = $(this).attr('mm');
    getCal(yy, mm);
    return false;
}

