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() {
        this.itemInit();
        this.eventInit();
        this.otherInit();
    },
    itemInit:function() {
        
    },
    eventInit:function(){
    },
    otherInit:function(){
        if(isIphone()){

        }else {
            document.addEventListener("backbutton", app.backbuttonAction, false);
        }
    },
    backbuttonAction:function(){
        var isPopupClose = false;
        if ($("#layerPopup.Popup05").is(':visible')){
            isPopupClose = true;
            app.hideInputPinPopup();
        }
        if ($("#layerPopup.Popup07").is(':visible')){
            isPopupClose = true;
            app.hideSaveCompletedPopup();
        }
        if ($("#layerPopup.Popup08").is(':visible')){
            isPopupClose = true;
            app.hideDeviceListPopup();
        }
        if ($("#layerPopup.Popup10").is(':visible')){
            isPopupClose = true;
            app.hideDeletePopup();
        }
        if(!isPopupClose){
            cordova.plugins.finPlugin.backButton("", null, null);
        }
    },
    mobileIntegrity:function(){
        var data = SET03.DATA;
        cordova.plugins.finPlugin.moveStack(data,null,null);
    },
    mobileSetting:function(){
        var data = SET01.DATA;
        cordova.plugins.finPlugin.moveStack(data, null,null);
    },
    
    mobileVatSet:function(){
        var data = SET04.DATA;
        cordova.plugins.finPlugin.moveStack(data, null,null);
    },
    
    mobileUserSet:function(){
        var data = SET05.DATA;
        cordova.plugins.finPlugin.moveStack(data, null,null);
    }
};

app.initialize();