function badBrowser() {
    if ($.browser.msie && parseInt($.browser.version) <= 7) {
        return true;
    }
    //if ($.browser.mozilla) { return true; } //Remove this line so you will not get the warning in Firefox.
    return false;
}

function getBadBrowser(c_name) {
    if ($.cookie(c_name) != "") {
        return $.cookie(c_name);
    }
    return "";
}	

function setBadBrowser(c_name, value) {
    $.cookie(c_name, value, {
        expires: 7,
        path: '/'
    });
}

if (badBrowser() && getBadBrowser('browserWarning') != 'seen' ) {
    $(document).ready(function() {
        // Did you know that your browser is out of date? To get the best possible experience using our website we recommend that you upgrade your
        // browser to a newer version. The current version is Internet Explorer 7 and Internet Explorer 8 is available as a beta. The upgrade is free.
        // If you are using a PC at work you should contact your IT administrator.
        // If you want to you may also try some other popular Internet browsers such as Firefox, Safari or Opera.

        var rhm = /10\.9\..*/;
        if (remotehost != undefined && !remotehost.match(rhm)) {
            $("<div id=\"browserWarning\"><h2>Did you know that your browser is out of date?</h2><p>To get the best possible experience using our website we recommend that you upgrade your browser to a newer version. The current version is <a href=\"http://www.microsoft.com/windows/internet-explorer/default.aspx\" title=\"Upgrade to Internet Explorer 8\" target=\"_blank\">Internet Explorer 8</a>. The upgrade is free. If you are using a PC at work you should contact your IT administrator.</p><p>If you want to you may also try some other popular Internet browsers such as <a href=\"http://getfirefox.com\" title=\"Try Firefox\" target=\"_blank\">FireFox</a>, <a href=\"http://www.apple.com/safari/\" title=\"Try Safari\" target=\"_blank\">Safari</a> or <a href=\"http://www.opera.com/download/\" title=\"Try Opera\" target=\"_blank\">Opera</a>.</p><p class=\"small\">[<a href=\"#\" title=\"Close warning\" id=\"warningClose\">Close</a>]</p></div>")
            .css({
                position: 'absolute',
                top: 0,
                left: 0,
                backgroundColor: '#fcfdde',
                'width': '100%',
                'border-top': 'solid 1px #999',
                'border-bottom': 'solid 1px #999',
                'text-align': 'left',
                padding:'5px 15px 5px 15px',
                'z-index': 1000,
                'font-size': '11px'
            })
            .prependTo("body");

            $('#warningClose').click(function() {
                setBadBrowser('browserWarning','seen');
                $('#browserWarning').slideUp('fast');
                return false;
            });
        }
    });
}
