﻿// Setup the initial state
var ie6WarningContainer = $(".ie6WarningContainer");
if (ie6WarningContainer.length > 0) 
{
    // We have the IE6 container, check if the user has seen the message previously.
    if (IsIE6OrBelow() && $.cookie("ie6WarningShown") == null)
    {
        // Its been shown to the user, hide the message
        ie6WarningContainer.show();
    }
}

// Wireup the close waning button
$(".ie6WarningClose").bind('click', function()
{
    // Set the datetime when the user was clicked on the close button
    $.cookie("ie6WarningShown", GetCurrentTimeAsString(), { expires: 28 });

    // Hide the message
    $(ie6WarningContainer).hide();
});

function IsIE6OrBelow()
{
    return $.browser.msie && $.browser.version < 7;
}

function GetCurrentTimeAsString()
{
    var currentTime = new Date();
    var month = currentTime.getMonth() + 1;
    var day = currentTime.getDate();
    var year = currentTime.getFullYear();
    return year + "/" + month + "/" + day; 
}
