WS_waitscreen = true;
curInf = '';
feesInf = '';
curInfR = ''

window.onload = function(){
    
    // Go back
    document.getElementById('previous-button').addEventListener("click", function(){
        if(getParameterByName('ac')){
            gotoPage('step','withdrawFundsAc',{ 'sessionid' : getParameterByName('sessionid'),'cid' : getParameterByName('cid'),'q' : getParameterByName('q') })
        }else{
            gotoPage('step','withdrawFundsAcC',{ 'sessionid' : getParameterByName('sessionid'),'cid' : getParameterByName('cid'),'q' : getParameterByName('q') })
        }
    });
    
    // Go step 4
    document.getElementById('next-button').addEventListener("click", function(){
        verifyNextButton()
    });
    
    // Go back R
    document.getElementById('previous-buttonR').addEventListener("click", function(){
        if(getParameterByName('ac')){
            gotoPage('step','withdrawFundsAc',{ 'sessionid' : getParameterByName('sessionid'),'cid' : getParameterByName('cid'),'q' : getParameterByName('q') })
        }else{
            gotoPage('step','withdrawFundsAcC',{ 'sessionid' : getParameterByName('sessionid'),'cid' : getParameterByName('cid'),'q' : getParameterByName('q') })
        }
    });
    
    // Go step 4 R
    document.getElementById('next-buttonR').addEventListener("click", function(){
        verifyNextButton()
    });
    
    // Step
    document.getElementById('floatButton').addEventListener("click",function(){
        var popup = document.getElementById("floatButton").children[0].children[0];
        if(popup.classList.contains('show')){
            gotoPage('dashboard','home',{ 'sessionid' : getParameterByName('sessionid') })
        }else{
            popup.classList.toggle("show");
        }
    })

    document.getElementById('floatClose').addEventListener("click",function(event){
        var popup = document.getElementById("floatButton").children[0].children[0];
        popup.classList.remove("show")
        event.stopPropagation()
    })
    
    // Session Update
    document.getElementById('expSessionButton').addEventListener("click",function(){
        var req = {
            'sessionid': getParameterByName('sessionid')
        }
        sessionUpdate(req)
    })
    
    // Anular Fiat
    document.getElementById('wdFiatbuttonA').addEventListener("click", function(){
        var req = {
            'id': document.getElementsByClassName('withdrawFiatConfirm')[0].getAttribute('tridWI'),
            'sessionid': getParameterByName('sessionid')
        }
        transactionsCancel(req)
    });
    
    // Anular BTC
    document.getElementById('wdBTCbuttonA').addEventListener("click", function(){
        document.getElementsByTagName('body')[0].classList.remove('hidden')
        var req = {
            'id': document.getElementsByClassName('withdrawBTCConfirm')[0].getAttribute('tridWI'),
            'sessionid': getParameterByName('sessionid')
        }
        transactionsCancel(req)
    });
    
    // Finalizar fail
    document.getElementById('wdFiatbuttonI').addEventListener("click", function(){
        document.getElementsByClassName('failure')[0].style.display = "none"
        document.getElementById('failureMsg').innerHTML = ''
    });
    
    document.getElementById('withdrawFiatConfirmResend').addEventListener("click", function(){
        var req = {
            'id': document.getElementsByClassName('withdrawFiatConfirm')[0].getAttribute('tridwi'),
            'sessionid': getParameterByName('sessionid')
        }
        
        transactionsValidation(req)
    });
    
    document.getElementById('withdrawBTCConfirmResend').addEventListener("click", function(){
        var req = {
            'id': document.getElementsByClassName('withdrawBTCConfirm')[0].getAttribute('tridwi'),
            'sessionid': getParameterByName('sessionid')
        }
        
        transactionsValidation(req)
    });
    
    document.getElementById('wdFiatbuttonV').addEventListener("click", function(){
        verifywdFiatbuttonV()
    });
    
    // Validar BTC
    document.getElementById('wdBTCbuttonV').addEventListener("click", function(){
        verifywdBTCbuttonV();
    });
    
    // Go to preferences
    document.getElementById('preferences').addEventListener("click", function(){
        gotoPage('preferences','main',{ 'sessionid' : getParameterByName('sessionid') })
    });
    
    // Go to preferences
    document.getElementById('preferencesR').addEventListener("click", function(){
        gotoPage('preferences','main',{ 'sessionid' : getParameterByName('sessionid') })
    });
    
    // Go to balance
    document.getElementById('balance').addEventListener("click", function(){
        gotoPage('balance','balance',{ 'sessionid' : getParameterByName('sessionid') })
    });
    
    // Go to balance
    document.getElementById('balanceR').addEventListener("click", function(){
        gotoPage('balance','balance',{ 'sessionid' : getParameterByName('sessionid') })
    });
    
    document.getElementById('example-element-toggle2').checked = false;
    
    // Bar
    document.getElementById('togglebar').addEventListener("click", function(){
        var el = document.getElementById('addView2')
        document.getElementById('addView2').style.display = 'block'
        setTimeout(function(){ 
            document.getElementById('example-element-toggle2').checked = !document.getElementById('example-element-toggle2').checked;
        }, 15);   
        
    });
    
    // Logout
    document.getElementById('logouticon').addEventListener("click", function(){
        logout();
    });
    
    // Logout
    document.getElementById('logouticon2').addEventListener("click", function(){
        logout();
    });
    
    init()
    
    //Mostrar HTML cargado
    esconderHTML(false);
    
    var waitScreen = document.getElementById("waitScreen");
    document.body.removeChild(waitScreen);
    WS_waitscreen = false;
    document.getElementsByClassName('pageCnt')[0].style.visibility="visible"
}

function expiredSession(){
    document.getElementsByClassName('expired')[0].style.display = "table"
    WS_waitscreen = false;
    var seconds = 30;
    var countdown = setInterval(countDown, 1000);
    
    function countDown(){
        seconds--;
        if(seconds == 0){
            if(document.getElementsByClassName('expired')[0].style.display == "table"){
                gotoPage('login','main','');
                clearInterval(countdown);
            }
        }
        if(document.getElementsByClassName('expired')[0].style.display == "none"){
            clearInterval(countdown)
        }
    }
}

function sessionUpdate(req){
    callWS('GET', 'session/update', req, response);
    function response(status, rsp){
        console.log('session/update')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                document.getElementsByClassName('expired')[0].style.display = "none";
                init()
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function init(){
    setLang()
}

function getEntry(sessionid){
    callWS("GET", "users/entry", { 'sessionid' : sessionid}, response);
        
    function response(status, rsp){
        switch(status){
            case 200:
                entrydata = (JSON.parse(rsp).entry)
                putName(entrydata);
                document.getElementById('withdrawFiatConfirmEmail').children[0].innerHTML = JSON.parse(rsp).entry.usr
                document.getElementById('withdrawBTCConfirmEmail').children[0].innerHTML = JSON.parse(rsp).entry.usr
                var req = {
                    'sessionid': getParameterByName('sessionid'),
                    'action': 3, /*1 INtercambio, 2 Deposito, 3 Retiro, 4 Transferencia
                    'currencyid': getParameterByName('cid)*/
                }
                accountsPortfolio(req)
                break;
            case 204:
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                break;
            default:
                break;
        }
    }    
}

function putName(entrydata){
    var name;
    if(entrydata.company){
        if(entrydata.company.name.value=="" || entrydata.company.name.value== null){
            name = entrydata.usr
        }else{
            name = entrydata.company.name.value
        }
    }
    else if(entrydata.person){
        if(entrydata.person.firstname.value=="" || entrydata.person.firstname.value==null){
            name = entrydata.usr
        }else{
            name = entrydata.person.firstname.value + ' '+ entrydata.person.firstlastname.value
        }
    }
    document.getElementById('name').innerHTML = name
    document.getElementById('name2').innerHTML = name
}

function logout(){
    var sessionid = getParameterByName('sessionid')
    var req ={
        'sessionid': sessionid,
    }
    callWS('GET', 'login/logout', req, response);

    function response(status, rsp){
        console.log(JSON.parse(rsp));
        console.log(status)
        switch(status){
            case 200:
                gotoPage('login','main','')
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function accountsList(req){
    callWS('GET', 'accounts/list', req, response);
    function response(status, rsp){
        console.log('accounts/list')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                curInf = null;
                JSON.parse(rsp).records.forEach(currency => {
                    if(currency.id == getParameterByName('ac')){
                        curInf = currency;
                    }   
                });
                req = {
                    'sessionid': getParameterByName('sessionid'),
                    'currencyid': getParameterByName('cid')
                }
                console.log(curInf)
                if(curInf){
                    feesEntry(req,curInf,'F')
                }else{
                    feesEntry(req,curInf,'C')
                }
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

// fees/entry
function feesEntry(req,accPor,type){
    callWS('GET', 'fees/entry', req, response);
    function response(status, rsp){
        console.log('fees/entry')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                loadData(accPor,JSON.parse(rsp),type)
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function verifyNextButton(){
    if(document.getElementById('tableF').classList.contains('displayNone')){
        console.log('Cr')
        var req = {
            'accountid': curInfR.id,
            'amount': getParameterByName('q'),
            'paymentwallet': getParameterByName('ad'),
            'sessionid': getParameterByName('sessionid')
        }
        console.log(req)
        withdrawalsInsert(req,'CR')
    }else{
        console.log('Fiat')
        console.log(curInf)
        var req = {
            'accountid': curInfR.id,
            'amount': getParameterByName('q'),
            'paymentaccountid': curInf.id,
            'sessionid': getParameterByName('sessionid')
        }
        console.log(curInfR)
        console.log(req)
        withdrawalsInsert(req,'FIAT')
    }
}
function withdrawalsInsert(req,type){
    console.log(req)
    callWS('POST', 'withdrawals/insert', req, response);
    function response(status, rsp){
        console.log('Aqui withdrawals/insert')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                if (type=='CR'){
                    document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "table"
                    document.getElementsByClassName('withdrawBTCConfirm')[0].setAttribute('idWI',JSON.parse(rsp).id)
                    document.getElementsByClassName('withdrawBTCConfirm')[0].setAttribute('tridWI',JSON.parse(rsp).transacctionid)
                }
                else if (type == 'FIAT'){
                    document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "table"
                    document.getElementsByClassName('withdrawFiatConfirm')[0].setAttribute('idWI',JSON.parse(rsp).id)
                    document.getElementsByClassName('withdrawFiatConfirm')[0].setAttribute('tridWI',JSON.parse(rsp).id)
                }
                break;
            case 400:
                document.getElementsByClassName('withdrawBTC')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiat')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
            case 401:
                expiredSession();
                break;
            case 403:
                document.getElementById('failureMsg').innerHTML = JSON.parse(rsp).msg
                document.getElementById('failureMsg').innerHTML = JSON.parse(rsp).msg
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
            case 500:
                document.getElementsByClassName('withdrawBTC')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiat')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
            default:
                document.getElementsByClassName('withdrawBTC')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiat')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
        }
    }   
}



function loadData(currency,fees,type){
    console.log(currency)
    console.log(fees)
    if(type == 'F'){
        document.getElementById('tableF').classList.remove('displayNone')
        document.getElementById('titFiatW').children[0].innerHTML = currency.currency.symbol
        console.log(currency)
        console.log(fees)
        feesInf = fees
        document.getElementById('destBank').innerHTML = currency.paymentmethod.dsc
        document.getElementById('destAc').innerHTML = currency.details1
        document.getElementById('total').innerHTML = currency.currency.symbol + ' ' + number_format(parseFloat(getParameterByName('q')),curInfR.currency.decimals)
        
        if(fees.entry.withdrawals.nmalfee){
            document.getElementById('fees').innerHTML = number_format(parseFloat(fees.entry.withdrawals.nmalfee.number),curInfR.currency.decimals)
            document.getElementById('amount').innerHTML = number_format(parseFloat(getParameterByName('q')) + fees.entry.withdrawals.nmalfee.number,curInfR.currency.decimals)
            document.getElementById('amount').setAttribute('number',parseFloat(parseFloat(getParameterByName('q')) + parseFloat(fees.entry.withdrawals.nmalfee.number)))
        }
        else if(fees.entry.withdrawals.pctfee){
            document.getElementById('fees').innerHTML = currency.currency.symbol + ' ' + number_format(parseFloat(fees.entry.withdrawals.pctfee.number) * parseFloat(getParameterByName('q') / 100),curInfR.currency.decimals)
            document.getElementById('amount').innerHTML = currency.currency.symbol + ' ' + number_format(parseFloat(1 + parseFloat(fees.entry.withdrawals.pctfee.number)/100) * parseFloat(getParameterByName('q') ),curInfR.currency.decimals)
            document.getElementById('amount').setAttribute('number',parseFloat(1 + parseFloat(fees.entry.withdrawals.pctfee.number)/100) * parseFloat(getParameterByName('q') ))
            
        }else{
            console.log('N/A')
        }
        
        document.getElementById('withdrawFiatConfirmFee').innerHTML = document.getElementById('fees').innerHTML
        document.getElementById('withdrawFiatConfirmTotalN').innerHTML = document.getElementById('amount').innerHTML
        document.getElementById('withdrawFiatConfirmAmount').innerHTML = document.getElementById('total').innerHTML
        
    }else{
        console.log(curInf);
        console.log(feesInf);
        console.log(curInfR);
        document.getElementById('tableC').classList.remove('displayNone')
        document.getElementById('titCrW').children[0].innerHTML = curInfR.currency.symbol
        document.getElementById('destBankC').innerHTML = getParameterByName('ad')
        document.getElementById('totalC').innerHTML = curInfR.currency.symbol + ' ' + number_format(parseFloat(getParameterByName('q')),curInfR.currency.decimals)
        if(fees.entry.withdrawals.nmalfee){
            document.getElementById('feesC').innerHTML = curInfR.currency.symbol + ' ' + number_format(parseFloat(fees.entry.withdrawals.nmalfee.number),curInfR.currency.decimals)
            document.getElementById('amountC').innerHTML = curInfR.currency.symbol + ' ' + number_format((parseFloat(getParameterByName('q')) - fees.entry.withdrawals.nmalfee.number),curInfR.currency.decimals)
            document.getElementById('amountC').setAttribute('number',parseFloat(parseFloat(getParameterByName('q')) - parseFloat(fees.entry.withdrawals.nmalfee.number)))
        }
        else if(fees.entry.withdrawals.pctfee){
            document.getElementById('feesC').innerHTML = curInfR.currency.symbol + ' ' + curInfR.currency.symbol + ' ' + number_format(parseFloat(fees.entry.withdrawals.pctfee.number) * parseFloat(getParameterByName('q') / 100),
                                                                                                                                         curInfR.currency.decimals)
            document.getElementById('amountC').innerHTML = curInfR.currency.symbol + ' ' + number_format(parseFloat(1 - parseFloat(fees.entry.withdrawals.pctfee.number)/100) * parseFloat(getParameterByName('q') ),
                                                                                                        curInfR.currency.decimals)
            document.getElementById('amount').setAttribute('number',parseFloat(1 - parseFloat(fees.entry.withdrawals.pctfee.number)/100) * parseFloat(getParameterByName('q') ))
            
        }else{
            console.log('N/A')
        }   
        document.getElementById('withdrawBTCConfirmWallet').innerHTML = getParameterByName('ad')
        document.getElementById('withdrawBTCConfirmFee').innerHTML = document.getElementById('feesC').innerHTML
        document.getElementById('withdrawBTCConfirmTotalN').innerHTML = document.getElementById('amountC').innerHTML
        document.getElementById('withdrawBTCConfirmAmount').innerHTML = document.getElementById('totalC').innerHTML
    }
}

function accountsPortfolio(req){
    callWS('GET', 'accounts/portfolio', req, response);
    function response(status, rsp){
        console.log('accounts/portfolio')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                curInfR = null;
                JSON.parse(rsp).records.forEach(currency => {
                    if(currency.currency.id == getParameterByName('cid')){
                        curInfR = currency;
                    }   
                });
                var req = {
                    'sessionid': getParameterByName('sessionid'),
                    'paym': 1
                }
                accountsList(req)
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function onlyNumber(e){
    tecla = (document.all) ? e.keyCode : e.which;

    if (tecla == 8) {
        return true;
    }
    
    patron = /[0-9]/;
    tecla_final = String.fromCharCode(tecla);
    return patron.test(tecla_final);
}

// xfer/make 
function transactionsCancel(req){
    console.log(req)
    callWS('GET', 'transactions/cancel', req, response);
    function response(status, rsp){
        console.log('transactions/cancel')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none"
                document.getElementsByTagName('body')[0].classList.remove('hidden')
                break;
            case 401:
                expiredSession();
                break;
            default:
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
        }
    }   
}

function transactionsValidation(req){
    console.log(req)
    callWS('GET', 'transactions/validation', req, response);
    function response(status, rsp){
        console.log('transactions/validation')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                break;
            case 400:
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
            case 401:
                expiredSession();
                break;
            default:
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
        }
    }   
}

function verifywdFiatbuttonV(){
    
    if(document.getElementById('withdrawFiatConfirmCode').value == ''){
        error('withdrawFiatConfirmCode','ewithdrawFiatConfirmCode','Introduzca un código.');
        document.getElementById('ewithdrawFiatConfirmCode').style.display = 'block'
        document.getElementById('ewithdrawFiatConfirmCode').style.marginLeft = '20px'
        return;
        
    }
                    
    var req = {
        'id': document.getElementsByClassName('withdrawFiatConfirm')[0].getAttribute('tridWI'),
        'validator': document.getElementById('withdrawFiatConfirmCode').value,
        'sessionid': getParameterByName('sessionid')
    }
    
    TransactionsAccept(req,'Fiat')
}

function verifywdBTCbuttonV(){
    
    if(document.getElementById('withdrawBTCConfirmCode').value == ''){
        error('withdrawBTCConfirmCode','ewithdrawBTCConfirmCode','Introduzca un código.');
        document.getElementById('ewithdrawBTCConfirmCode').style.display = 'block'
        document.getElementById('ewithdrawBTCConfirmCode').style.marginLeft = '20px'
        return;
        
    }
                    
    var req = {
        'id': document.getElementsByClassName('withdrawBTCConfirm')[0].getAttribute('tridWI'),
        'validator': document.getElementById('withdrawBTCConfirmCode').value,
        'sessionid': getParameterByName('sessionid')
        
    }
    
    TransactionsAccept(req,'BTC')
}

function TransactionsAccept(req,type){
    console.log(req)
    callWS('GET', 'transactions/accept', req, response);
    function response(status, rsp){
        console.log('Aqui transactions/accept')
        console.log(JSON.parse(rsp));
        console.log(status)
        switch(status){
            case 200:
                if( type == 'BTC'){  
                    document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none" 
                    gotoPage('step','final',{ 'sessionid' : getParameterByName('sessionid') })
                }  
                if( type == 'Fiat'){ 
                    document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none" 
                    gotoPage('step','final',{ 'sessionid' : getParameterByName('sessionid') })
                }
                break;
            case 400:
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none" 
                document.getElementsByClassName('transferBTCConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none" 
                document.getElementsByClassName('failure')[0].style.display = "table"
                break; 
            case 401: 
                expiredSession();
                break;
            case 402:
                if(type == 'BTC'){
                    error('withdrawBTCConfirmCode','ewithdrawBTCConfirmCode','Código inválido.'); 
                    document.getElementById('ewithdrawBTCConfirmCode').style.display = 'block';
                    document.getElementById('ewithdrawBTCConfirmCode').style.marginLeft = '20px';
                }
                if(type == 'Fiat'){
                    error('withdrawFiatConfirmCode','ewithdrawFiatConfirmCode','Código inválido.');
                    document.getElementById('ewithdrawFiatConfirmCode').style.display = 'block'
                    document.getElementById('ewithdrawFiatConfirmCode').style.marginLeft = '20px'
                }
                break;
            case 403:
                if(type == 'BTC'){
                    error('withdrawBTCConfirmCode','ewithdrawBTCConfirmCode','Código expirado.'); 
                    document.getElementById('ewithdrawBTCConfirmCode').style.display = 'block';
                    document.getElementById('ewithdrawBTCConfirmCode').style.marginLeft = '20px';
                }
                if(type == 'Fiat'){
                    error('withdrawFiatConfirmCode','ewithdrawFiatConfirmCode','Código expirado.');
                    document.getElementById('ewithdrawFiatConfirmCode').style.display = 'block'
                    document.getElementById('ewithdrawFiatConfirmCode').style.marginLeft = '20px'
                }
                break;
            case 500:
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
            default:
                document.getElementsByClassName('withdrawBTCConfirm')[0].style.display = "none"
                document.getElementsByClassName('withdrawFiatConfirm')[0].style.display = "none"
                document.getElementsByClassName('failure')[0].style.display = "table"
                break;
        }
    }   
}

function setLang(){
    
    lang = localStorage.getItem('lang');
    
    /* inner HTML */
    setWordLanginnerHTML('home','home');
    setWordLanginnerHTML('balance','balance');
    setWordLanginnerHTML('preferences','preferences');
    setWordLanginnerHTML('homeR','home');
    setWordLanginnerHTML('balanceR','balance');
    setWordLanginnerHTML('preferencesR','preferences');
    setWordLanginnerHTML('langIcon','langIcon');
    
    
    setWordLanginnerHTML('titlePage','titlePage');
    setWordLanginnerHTML('step1','step1');
    setWordLanginnerHTML('step2','step2');
    setWordLanginnerHTML('step3','step3');
    setWordLanginnerHTML('step4','step4');
    setWordLanginnerHTML('step5','step5');
    setWordLanginnerHTML('t1','t1');
    
    setWordLanginnerHTML('t2','t2');
    setWordLanginnerHTML('DestinationBank','DestinationBank');
    setWordLanginnerHTML('DestinationAccount','DestinationAccount');
    setWordLanginnerHTML('WillRetire','WillRetire');
    setWordLanginnerHTML('feesLabel','feeLabel');
    
    setWordLanginnerHTML('DestinationAddress','DestinationAddress');
    setWordLanginnerHTML('WillRetire2','WillRetire');
    setWordLanginnerHTML('feesLabel2','feeLabel');
    
    setWordLanginnerHTML('previous-button','RETURN');
    setWordLanginnerHTML('next-button','continue');
    setWordLanginnerHTML('previous-buttonR','RETURN');
    setWordLanginnerHTML('next-buttonR','continue');
    
    
    setWordLanginnerHTML('buttonAdv','ADVANCEDMODE');
    setWordLanginnerHTML('question','question');
    setWordLanginnerHTML('expired1','expired1');
    setWordLanginnerHTML('expired2','expired2');
    setWordLanginnerHTML('expSessionButton','continue');
    setWordLanginnerHTML('ts','ts');

    
    document.getElementById('floatClose').addEventListener("click",function(event){
        var popup = document.getElementById("floatButton").children[0].children[0];
        popup.classList.remove("show")
        event.stopPropagation()
    })
    
    getEntry(getParameterByName('sessionid'));

}