$(document).ready(function () {
    $("#back").tap(function () {
        window.history.back();
    });

    $("<div/>", {
        id: "loading"
    }).addClass("local-alert").append("<table><tr><td><img id='img-loading' src='/img/loading.gif'/></td></tr><tr><td data-localize='loading'>Loading...</td></tr>").appendTo("body");
    $("<div/>", {
        id: "offline"
    }).addClass("local-alert").append("<table><tr><td data-localize='offline'>No Internet Connection. Please check your connection settings and try again.</td></tr>").appendTo("body");
   
    localizationOptions.language = Settings.getLanguage().name;
    
    $("[data-localize]").localize("lang", localizationOptions);
    if (!window.navigator.onLine) {
        $("#offline").show();
    } else {
        $("#offline").hide();
    }
    window.addEventListener("offline", function(e) {
        $("#offline").show();
    });
    window.addEventListener("online", function (e) {
        $("#offline").hide();
    });
});
var localizationOptions = {pathPrefix: "/resources", skipLanguage: /^en/ };
function loadDefaultGroup(img) {
    img.onerror = null;
    img.src = "/img/football/0.gif";
}

function clearLogo(img) {
    img.onerror = null;
    img.style.visibility = "hidden";
}

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}