(function ($) {
    $(function () {
        Cookies.checkEnable();
        $(".languageen").live("click", function () {
            Ajax.ajaxLanguage("en-US");
        });
        $(".languagebr").live("click", function () {
            Ajax.ajaxLanguage("pt-BR");
        });

        $("#coin-slider").nivoSlider({
            effect: 'fade',
            pauseOnHover: false,
            directionNav: false,
            pauseTime: 2000
        });
    });

    var Ajax = {
        ajaxLanguage: function (language) {
            //alert("ok" + language);
            $.ajax({
                type: "POST",
                url: getURLRoot() + "/Language/" + language,
                success: function () {
                    window.location = window.location;
                },
                error: function () {
                    alert("Erro ao trocar o idioma");
                }
            });
        }
    };
    var Cookies = {
        checkEnable: function () {
            var dt = new Date();
            dt.setSeconds(dt.getSeconds() + 60);
            document.cookie = "cookietest=1; expires=" + dt.toGMTString();
            var cookiesEnabled = document.cookie.indexOf("cookietest=") != -1;
            if (!cookiesEnabled) {
                alert("Funcionalidade de cookies do seu navegador está desativado.\nPor favor, ligue-o para funcionamento correto do site.");
            }
        }
    };

})(jQuery);
function getURLRoot() {
    var rootURL = document.location.protocol + "//" + document.location.host
    return rootURL
}