﻿var isIE7 = false;
var slideDir = "right";

jQuery.each(jQuery.browser, function (i)
{
    if ($.browser.msie && jQuery.browser.version == '7.0')
    {
        isIE7 = true;
    }
});

function Init()
{
    //HACK: only IE7 needs this
    if (isIE7)
    {
        $("#calendarForm").submit(function (event) { eval($(this).attr("onsubmit")); return false; });
    }
}

function next()
{
    if (parseInt($('#currentMonth').val()) >= 12)
    {
        $('#month').val(1);
        $('#year').val(parseInt($('#currentYear').val()) + 1);
    }
    else
    {
        $('#month').val(parseInt($('#currentMonth').val()) + 1);
        $('#year').val($('#currentYear').val());
    }
    //HACK: only IE7 needs this
    if (isIE7)
    {
        $('#calendarForm').submit();
    }
    slideDir = "right";
    $('.calendar-row').hide();
}

function prev()
{
    if (parseInt($('#currentMonth').val()) <= 1)
    {
        $('#month').val(12);
        $('#year').val(parseInt($('#currentYear').val()) - 1);
    }
    else
    {
        $('#month').val(parseInt($('#currentMonth').val()) - 1);
        $('#year').val($('#currentYear').val());
    }
    //HACK: only IE7 needs this
    if (isIE7)
    {
        $('#calendarForm').submit();
    }
    slideDir = "left";
    $('.calendar-row').hide();
}

function reveal()
{
    $('.calendar-row').show();
}
