var app = {
    // Application Constructor
    initialize: function()
    {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function()
    {
        if (navigator.connection.type == Connection.NONE)
        {
            //navigator.notification.alert('An internet connection is required to continue');
            document.getElementById( 'offline-info' ).style.display = 'block';
        }
        else
        {
            document.getElementById( 'offline-info' ).style.display = 'none';
            window.location="https://app.probuddy.de/?fromCordova=true";
            /*
            window.cache.clear(
                function()
                {
                    //window.location="https://www.probuddy.de";
                    //window.location="http://192.168.178.25:1340/?fromCordova=true";
                    window.location="https://app.probuddy.de/?fromCordova=true";
                },
                function()
                {
                    navigator.notification.alert("Cache cannot be cleared" );
                }
            );
            window.cache.cleartemp();
            */
        }
    }
};

app.initialize();