WS_waitscreen = true;
numofrec = 6
currencies = {};

window.onload = function(){
    
    // Call Entry 
    setLang()
    
    if(screen.width <= 700){
        numofrec = ''
    }
     
     document.getElementById('example-element-toggle2').checked = false;
     
     // Bar
    document.getElementById('togglebar').addEventListener("click", function(){
        var el = document.getElementById('addView2')
        //el.style.display = 'block';
        //el.style.display = (el.style.display == 'none') ? 'block' : 'none';
        //document.getElementById('datas').style.display = 'none'
        document.getElementById('addView2').style.display = 'block'
        setTimeout(function(){ 
            document.getElementById('example-element-toggle2').checked = !document.getElementById('example-element-toggle2').checked;
        }, 15);   
        
    });
    
    // Go to home
    document.getElementById('home').addEventListener("click", function(){
        goToStart()
    });
    
    // Go to home
    document.getElementById('homeR').addEventListener("click", function(){
        goToStart()
    });
    
    // 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') })
    });
    
    document.getElementById('logouticon').addEventListener("click", function(){
        logout();
    });
    document.getElementById('logouticon2').addEventListener("click", function(){
        logout();
    });
    
    if(screen.width > 700){
        document.getElementById('totalPortfolioSel').addEventListener("change",function(){
            var req = {
                'sessionid': getParameterByName('sessionid'),
                'currencyid': document.getElementById('totalPortfolioSel').value,
                'filter': document.getElementById("search").value,
                'numofrec': numofrec,
            };
            console.log(currencies)
            currencies.records.forEach(record => {
                if(record.id == document.getElementById('totalPortfolioSel').value){
                    document.getElementById('totalPortfolioSel').setAttribute('decimal',record.decimals)
                }
            });
            balanceAccounts(req,'')
        })
    }else{
        document.getElementById('totalPortfolioSelR').addEventListener("change",function(){
            var req = {
                'sessionid': getParameterByName('sessionid'),
                'currencyid': document.getElementById('totalPortfolioSelR').value,
                'filter': document.getElementById("search").value,
                'numofrec': numofrec,
            };
            console.log(currencies)
            currencies.records.forEach(record => {
                if(record.id == document.getElementById('totalPortfolioSelR').value){
                    document.getElementById('totalPortfolioSelR').setAttribute('decimal',record.decimals)
                }
            });
            balanceAccounts(req,'')
        })
    }

    
    // Session Update
    document.getElementById('expSessionButton').addEventListener("click",function(){
        var req = {
            'sessionid': getParameterByName('sessionid')
        }
        sessionUpdate(req)
    })
    
    document.getElementById("iconSearch").addEventListener("click", function(){
        var filter = document.getElementById("search").value;
        if(filter == null || filter == undefined){
            filter  = '';
        }
        //Se desmarca la pagina anterior
        var pSel = document.getElementsByClassName("pSelect");
        if(pSel.length>0)pSel[0].classList.remove("pSelect");
            
        //Colocamos la pagina 1
        var page1 = document.getElementsByClassName("pages")[0];
        if(page1 != undefined){
            page1.classList.add("pSelect");
        }
        
        var sessionId = getParameterByName('sessionid');
        var numofrecords = numofrec;
        var currencyid = 0;
        if(screen.width > 700){
            currencyid = document.getElementById('totalPortfolioSel').value
        }else{
            currencyid = document.getElementById('totalPortfolioSelR').value
        }
                    
        var req = {
            'sessionid': getParameterByName('sessionid'),
            'currencyid': currencyid,
            'filter' : filter,
            'numofrec': numofrecords,
        };
        balanceAccounts(req,'')
    });
    
    // Event to input search
    document.getElementById("search").addEventListener("change",function(){
        var filter = document.getElementById("search").value;
        if(filter == null || filter == undefined){
            filter  = '';
        }
        
        //Se desmarca la pagina anterior
        var pSel = document.getElementsByClassName("pSelect");
        if(pSel.length>0)pSel[0].classList.remove("pSelect");
            
        //Colocamos la pagina 1
        var page1 = document.getElementsByClassName("pages")[0];
        if(page1 != undefined){
            page1.classList.add("pSelect");
        }
            
        var sessionId = getParameterByName('sessionid');
        var numofrecords = numofrec;
        var currencyid = 0;
        if(screen.width > 700){
            currencyid = document.getElementById('totalPortfolioSel').value
        }else{
            currencyid = document.getElementById('totalPortfolioSelR').value
        }
                    
        var req = {
            'sessionid': getParameterByName('sessionid'),
            'currencyid': currencyid,
            'filter' : filter,
            'numofrec': numofrecords,
        };
        balanceAccounts(req,'')
    });
    
    document.getElementsByClassName('pageCnt')[0].style.display="table";
    
    var req = {
        'sessionid': getParameterByName('sessionid')
    }
    balanceCurrencies(req)
    
    if(screen.width <= 700){
        responsiveBalance()
    }
    
    // Movimientos BTC Back
    document.getElementById('movBTCBack').addEventListener("click", function(){
        document.getElementsByClassName('movBTC')[0].style.display = "none"
    });
    
    // Movimientos VES Back
    document.getElementById('movVESBack').addEventListener("click", function(){
        document.getElementsByClassName('movVES')[0].style.display = "none"
        document.getElementsByTagName('body')[0].classList.remove('hidden')
    });
    
    // Salir de inf Movimiento Fiat
    document.getElementById('detailFiatButton').addEventListener("click", function(){
        document.getElementsByClassName('movDetailFiat')[0].style.display = "none"
        document.getElementsByClassName('movVES')[0].style.display = "table"
    });
    
    document.getElementById('acceptNoAccount').addEventListener("click", function(){
        document.getElementsByClassName('accountAttention')[0].style.display = "none"
    });
    
    document.addEventListener('click', function (evt) {
        if(evt.target.className === 'clickClose'){
            document.getElementsByClassName('movBTC')[0].style.display = "none"
        }
    })
    
    //Mostrar HTML cargado
    esconderHTML(false);
    
}

var waitScreen = document.getElementById("waitScreen");
waitScreen.style.opacity = 0;
setTimeout(function(){
    document.body.removeChild(document.getElementById("waitScreen"));
},600);
WS_waitscreen = false;


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('logout');
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function expiredSession(reason){
    
    // 'balanceCurrencies'  'balanceAccounts'
    if(reason == 'logout'){
        gotoPage('login','main','');
    }else{
        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"){
                if(reason == 'balanceCurrencies'){
                    var req = {
                        'sessionid': getParameterByName('sessionid')
                    }
                    balanceCurrencies(req)
                }else if(reason == 'balanceAccounts'){
                    
                    var filter = document.getElementById("search").value;
                    if(filter == null || filter == undefined){
                        filter  = '';
                    }
                    var req = {
                        'sessionid': getParameterByName('sessionid'),
                        'currencyid': document.getElementById('totalPortfolioSel').value,
                        'filter' : filter,
                        'numofrec': numofrec,
                    };
                    if(screen.width > 700){
                        for(i = 0; i < document.getElementsByClassName('pages').length; i++){
                            if(document.getElementsByClassName('pages')[i].classList.contains('pSelect')){
                                req.offset = i*numofrec
                            }
                        }   
                    }else{
                        req.currencyid = document.getElementById('totalPortfolioSelR').value
                        req.offset = ''
                    }
                    balanceAccounts(req,'')
                }
                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"
                break;
            case 400:
                break;
            case 401:
                expiredSession('sessionUpdate');
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function balanceCurrencies(req){
    callWS('GET', 'balance/currencies', req, response);
    function response(status, rsp){
        console.log('balance/currencies')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                currencies = JSON.parse(rsp)
                addOptions(currencies)
                break;
            case 400:
                break;
            case 401:
                expiredSession('balanceCurrencies');
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function addOptions(array) {
    removeOptions()
    if(screen.width > 700){
        var selector = document.getElementById('totalPortfolioSel');
        for (var i in array.records) {
            var opcion = document.createElement("option");
            opcion.text = array.records[i].symbol;
            opcion.value = array.records[i].id
            selector.add(opcion);
        }
        var req = {
            'sessionid': getParameterByName('sessionid'),
            'currencyid': document.getElementById('totalPortfolioSel').value,
            'numofrec': numofrec,
            'filter': document.getElementById("search").value
        };
        if(array.records){
            selector.setAttribute('decimal',array.records[0].decimals)   
        }
        balanceAccounts(req,'initial')   
    }else{
        var selector = document.getElementById('totalPortfolioSelR');
        for (var i in array.records) {
            var opcion = document.createElement("option");
            opcion.text = array.records[i].symbol;
            opcion.value = array.records[i].id
            selector.add(opcion);
        }
        var req = {
            'sessionid': getParameterByName('sessionid'),
            'currencyid': document.getElementById('totalPortfolioSelR').value,
            'numofrec': numofrec,
            'filter': document.getElementById("search").value
        };
        if(array.records){
            selector.setAttribute('decimal',array.records[0].decimals)   
        }
        balanceAccounts(req,'initial')  
    }
}

function removeOptions() {
    if(screen.width > 700){
        x = document.getElementById('totalPortfolioSel')
        var i, L = x.options.length - 1;
        for(i = L; i >= 0; i--) {
           x.remove(i);
        }
    }else{
        x = document.getElementById('totalPortfolioSelR')
        var i, L = x.options.length - 1;
        for(i = L; i >= 0; i--) {
           x.remove(i);
        }
    }
}

function balanceAccounts(req,reason){
    console.log(req)
    console.log(reason)
    callWS('GET', 'balance/accounts', req, response);
    function response(status, rsp){
        console.log('balance/accounts')
        console.log(JSON.parse(rsp));
        console.log(status) 
        switch(status){
            case 200:
                var newCurrencieArray = [];
                JSON.parse(rsp).record.forEach(record => {
                    if(record.id == 0){
                        newCurrencieArray.push(record.currency.id)
                    }
                });
                if(newCurrencieArray.length > 0 && reason==='initial'){
                    accountsGenerateN(newCurrencieArray.join('-'))
                }else{
                  balanceDraw(JSON.parse(rsp))  
                }
                break;
            case 400:
                break;
            case 401:
                expiredSession('balanceAccounts');
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

// Service accounts/generate
function accountsGenerateN(currencies){ 
    console.log('in accountsGenerateN')
    var sessionid = getParameterByName('sessionid');
    var req ={
        'sessionid': sessionid,
        'currencies' : currencies
    }
    console.log(req)
    callWS('GET', 'accounts/generate', req, response);
    function response(status, rsp){
        console.log(status)
        console.log(rsp)
        switch(status){
            case 200:
                var req = {
                    'sessionid': getParameterByName('sessionid'),
                    'currencyid': document.getElementById('totalPortfolioSel').value,
                    'numofrec': numofrec,
                    'filter': document.getElementById("search").value
                };
                balanceAccounts(req,'')
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function balanceDraw(rsp){
    var tbl;
    var node;
    var error;
    var header;
    if(screen.width > 700){
        tbl = document.getElementById('bodyTableCurrencies')
        node = tbl.children[1].cloneNode(true);
        error = tbl.children[0].cloneNode(true);
        tbl.innerHTML = "";
        tbl.appendChild(error);
    }else{
        tbl = document.getElementById('bodyTableCurrenciesR')
        node = tbl.children[1].cloneNode(true);
        error = tbl.children[0].cloneNode(true);
        tbl.innerHTML = "";
        tbl.appendChild(error);
    }
    
    var tmp = null; tmp = node.cloneNode(true);
    if((rsp.numofrecords == 0)){
        var ele = null;
        ele = tmp.cloneNode(true);
        ele.style.display = "none";
        tbl.appendChild(ele);
        
        document.getElementById("noCurrencieDefine").style.display= "flex";
        document.getElementById('noCurrencieDefine').style.justifyContent = "center";
        document.getElementById('noCurrencieDefine').classList.add('rowImpar')
        document.getElementById("msgInTable").innerHTML=getLangById("notBalances")[lang];
        document.getElementById("paginator").style.display= "none";
        
        document.getElementById("noCurrencieDefineR").style.display= "flex";
        document.getElementById('noCurrencieDefineR').style.justifyContent = "center";
        document.getElementById('noCurrencieDefineR').classList.add('rowImpar')
        document.getElementById("msgInTableR").innerHTML=getLangById("notBalances")[lang];
        
    }else{
        for(var i=0; i<rsp.record.length; i++){
            document.getElementById('noCurrencieDefine').style.display = "none"
            document.getElementById('noCurrencieDefineR').style.display = "none"
            
            if(screen.width > 700){
                document.getElementById("paginator").style.display= "table";
                var ele = null;
                ele = tmp.cloneNode(true);
                ele.style.display = "table";
                ele.children[0].children[0].children[0].innerHTML = rsp.record[i].currency.symbol 
                ele.children[1].children[0].children[0].innerHTML = rsp.record[i].balance.formatted 
                ele.children[2].children[0].children[0].innerHTML = rsp.record[i].last ? rsp.record[i].last : 'N/A'
                ele.children[3].children[0].children[0].innerHTML = rsp.record[i].pct ?  rsp.record[i].pct.formatted : '0,00%'
                ele.children[4].children[0].children[0].innerHTML = rsp.record[i].total ?  rsp.record[i].total.formatted : number_format(0,document.getElementById('totalPortfolioSel').getAttribute('decimal'))
                if(rsp.record[i].currency.interface == 4 || rsp.record[i].currency.interface == 5){
                    ele.children[5].children[0].children[0].innerHTML = '<i class="fas fa-exchange-alt" style="cursor: pointer; font-size: 130%;"></i>'
                    ele.children[5].children[0].children[0].children[0].setAttribute('i',i)
                    ele.children[5].children[0].children[0].children[0].setAttribute('interface',rsp.record[i].currency.interface)
                    ele.children[5].children[0].children[0].children[0].setAttribute('cid',rsp.record[i].currency.id)
                    
                    ele.children[5].children[0].children[0].children[0].addEventListener("click", function(){
                        gotoPage('step','transferCryptoAm',{ 'sessionid' : getParameterByName('sessionid'), 'cid' : this.getAttribute('cid') })
                    });
                
                }
                ele.children[6].children[0].children[0].innerHTML = '<i class="fas fa-download" style="cursor: pointer; font-size: 120%;"></i>'
                ele.children[6].children[0].children[0].children[0].setAttribute('i',i)
                ele.children[6].children[0].children[0].children[0].setAttribute('interface',rsp.record[i].currency.interface)
                ele.children[6].children[0].children[0].children[0].setAttribute('cid',rsp.record[i].currency.id)
                ele.children[6].children[0].children[0].children[0].setAttribute('decimals',rsp.record[i].currency.decimals)
                ele.children[6].children[0].children[0].children[0].setAttribute('idr',rsp.record[i].id)
                ele.children[6].children[0].children[0].children[0].addEventListener("click", function(){
                    if(this.getAttribute('interface') == 4 || this.getAttribute('interface') == 5){
                        gotoPage('step','depositFundsWa',{ 'sessionid' : getParameterByName('sessionid'), 'cid' : this.getAttribute('cid'), 'idr' : this.getAttribute('idr'), 'd' : this.getAttribute('decimals') })
                    }else{
                        gotoPage('step','depositFundsAm',{ 'sessionid' : getParameterByName('sessionid'), 'cid' : this.getAttribute('cid') })
                    }
                });
                    
                ele.children[7].children[0].children[0].innerHTML = '<i class="fas fa-upload" style="cursor: pointer; font-size: 120%;"></i>'
                ele.children[7].children[0].children[0].children[0].setAttribute('i',i)
                ele.children[7].children[0].children[0].children[0].setAttribute('interface',rsp.record[i].currency.interface)
                ele.children[7].children[0].children[0].children[0].setAttribute('cid',rsp.record[i].currency.id)
                ele.children[7].children[0].children[0].children[0].addEventListener("click", function(){
                    gotoPage('step','withdrawFundsAm',{ 'sessionid' : getParameterByName('sessionid'), 'cid' : this.getAttribute('cid') })
                });
                
                if(i % 2 != 0){
                    ele.classList.add('rowImpar')
                }else{
                    ele.classList.add('rowPar')
                }
                
                ele.setAttribute("id",rsp.record[i].id);
                ele.setAttribute("interface",rsp.record[i].currency.interface);
                ele.setAttribute("decimals",rsp.record[i].currency.decimals);
                ele.setAttribute("icSym",rsp.record[i].currency.symbol);
                
                ele.children[0].children[0].addEventListener("click", function(){
                    openMovementsModal(this.parentNode.parentNode)
                });
                ele.children[1].children[0].addEventListener("click", function(){
                    openMovementsModal(this.parentNode.parentNode)
                });
                ele.children[2].children[0].addEventListener("click", function(){
                    openMovementsModal(this.parentNode.parentNode)
                });
                ele.children[3].children[0].addEventListener("click", function(){
                    openMovementsModal(this.parentNode.parentNode)
                });
                ele.children[4].children[0].addEventListener("click", function(){
                    openMovementsModal(this.parentNode.parentNode)
                });
                
                tbl.appendChild(ele);   
            }else{
                document.getElementById('noCurrencieDefine').style.display = "none"
                document.getElementById("paginator").style.display= "none";
                var ele = null;
                ele = tmp.cloneNode(true);
                ele.style.display = "table";
                console.log(ele)
                ele.children[0].children[4].children[1].innerHTML = document.getElementById('totalPortfolioSelR').selectedOptions[0].text
                ele.children[1].children[0].children[0].innerHTML = rsp.record[i].currency.symbol 
                ele.children[1].children[1].children[0].innerHTML = rsp.record[i].balance.formatted 
                ele.children[1].children[2].children[0].innerHTML = rsp.record[i].last ? rsp.record[i].last : 'N/A'
                ele.children[1].children[3].children[0].innerHTML = rsp.record[i].pct ?  rsp.record[i].pct.formatted : '0,00%'
                ele.children[1].children[4].children[0].innerHTML = rsp.record[i].total ?  rsp.record[i].total.formatted : number_format(0,document.getElementById('totalPortfolioSelR').getAttribute('decimal'))
                
                ele.children[2].children[0].children[0].innerHTML = '<i class="fas fa-ellipsis-v" style="cursor: pointer; font-size: 130%;; color: #4287CE"></i>'
                ele.children[2].children[0].children[0].children[0].setAttribute('i',i)
                
                ele.setAttribute("id",rsp.record[i].id);
                ele.setAttribute("interface",rsp.record[i].currency.interface);
                ele.setAttribute("decimals",rsp.record[i].currency.decimals);
                ele.setAttribute("icSym",rsp.record[i].currency.symbol);
                
                ele.children[1].addEventListener("click", function(){
                    openMovementsModal(this.parentNode)
                });
                
                if(i % 2 != 0){
                    ele.classList.add('rowImpar')
                }else{
                    ele.classList.add('rowPar')
                }
                tbl.appendChild(ele);  
            }
            
        }
        document.getElementById('movVESBalance').innerHTML = rsp.total.formatted
        drawPags(rsp.numofrecords, "numbersPaginator",rsp.record.length);
    }
}

function drawPags(numofrecords, tbl, recordsAct){
    var pages;
    if(screen.width > 700){
        pages = Math.ceil( numofrecords / numofrec );
    }else{
        pages = 1
    }
    var numbersPaginator = document.getElementById(tbl);
    var lastPag = 0;
    if(numbersPaginator.getElementsByClassName("pSelect").length>0){
        lastPag = numbersPaginator.getElementsByClassName("pSelect")[0].getAttribute("data-page");
    }
    numbersPaginator.innerHTML = "";
    for(let k=0; k<pages; k++){
        var p = document.createElement("div");
        p.classList.add("pages");
        p.innerHTML = k+1;
        p.dataset.page= k+1;
        if(lastPag==0 && k==0)p.classList.add("pSelect");//Se selecciona la p芍gina 1
        else if(lastPag!==0 && (lastPag-1)==k)p.classList.add("pSelect");
        
        p.addEventListener("click", function(){
            //Se desmarca la pagina anterior
            var pSel = document.getElementsByClassName("pSelect");
            if(pSel.length>0)pSel[0].classList.remove("pSelect");
            
            //Se actualiza la pagina seleccionada
            this.classList.add("pSelect");
            
            //Se repinta el listado desde el offset seleccionado
            var filter = document.getElementById("search").value;
            
            if(filter == null || filter == undefined){
                filter  = '';
            }
            var offset = (this.innerHTML-1)*recordsAct;
            var sessionId = getParameterByName('sessionid');
            var numofrecords = numofrec;
            var currencyid = document.getElementById('totalPortfolioSel').value
            
            var req = {
                'sessionid': getParameterByName('sessionid'),
                'currencyid': document.getElementById('totalPortfolioSel').value,
                'filter' : filter,
                'numofrec': numofrecords,
                'offset' : offset
            };
            balanceAccounts(req,'')
            
            //LoadOrders(filter, offset, sessionId, numofrecords, currencyid);
        });
        p.style.cursor="pointer";
        numbersPaginator.appendChild(p);
                                
    }
    //Asignacion de eventos validar que se lo se haga una vez
    if(numbersPaginator.getAttribute("arrowsEvent")=="false"){
        var leftArrow = numbersPaginator.previousElementSibling;
        var rightArrow = numbersPaginator.nextElementSibling;
        //Evento flecha izquierda
        leftArrow.addEventListener("click",function(){
            var pSel = document.getElementsByClassName("pSelect");
            if(pSel.length>0){
                //Si el elemento anterior al seleccionado es una pagina
                if(pSel[0].previousElementSibling != null && pSel[0].previousElementSibling.classList.contains("pages")){
                    var last = pSel[0];
                    pSel[0].previousElementSibling.classList.add("pSelect");
                    last.classList.remove("pSelect");
                    //Se repinta el listado desde el offset seleccionado
                    var filter = document.getElementById("search").value;
            
                    if(filter == null || filter == undefined){
                        filter  = '';
                    }
                    var offset = (this.innerHTML-1)*recordsAct;
                    var sessionId = getParameterByName('sessionid');
                    var numofrecords = numofrec;
                    var currencyid = document.getElementById('totalPortfolioSel').value
                    
                    var req = {
                        'sessionid': getParameterByName('sessionid'),
                        'currencyid': document.getElementById('totalPortfolioSel').value,
                        'filter' : filter,
                        'numofrec': numofrecords,
                        'offset' : offset
                    };
                    balanceAccounts(req,'')
            
                    //LoadOrders(filter, offset, order, numofrecords, sessionId, daterange, type, pairid, status);
                }
            }
        });
        
        //Evento flecha derecha
        rightArrow.addEventListener("click",function(){
            var pSel = document.getElementsByClassName("pSelect");
            if(pSel.length>0){
                //Si el elemento anterior al seleccionado es una pagina
                if(pSel[0].nextElementSibling != null && pSel[0].nextElementSibling.classList.contains("pages")){
                    pSel[0].nextElementSibling.classList.add("pSelect");
                    pSel[0].classList.remove("pSelect");
                    
                    //Se repinta el listado desde el offset seleccionado
                    var filter = document.getElementById("search").value;
            
                    if(filter == null || filter == undefined){
                        filter  = '';
                    }
                    var offset = (this.innerHTML-1)*recordsAct;
                    var sessionId = getParameterByName('sessionid');
                    var numofrecords = numofrec;
                    var currencyid = document.getElementById('totalPortfolioSel').value
                    
                    var req = {
                        'sessionid': getParameterByName('sessionid'),
                        'currencyid': document.getElementById('totalPortfolioSel').value,
                        'filter' : filter,
                        'numofrec': numofrecords,
                        'offset' : offset
                    };
                    balanceAccounts(req,'')
            
                    //LoadOrders(filter, offset, order, numofrecords, sessionId, daterange, type, pairid, status);
                }
            }
        });
        
        //Evento flecha doble
        
        
        //Evento flecha doble derecha
        
        numbersPaginator.setAttribute("arrowsEvent",true);
    }
    
}

function responsiveBalance(){
    document.getElementById('tableCurrencies').style.display = 'none';
    document.getElementById('tableCurrenciesR').style.display = 'block';
    document.getElementById("paginator").style.display = 'none';
    document.getElementsByClassName('subTitlePage')[0].children[0].innerHTML = 'Balance'
    document.getElementById('headerFilter').classList.add('headerFilterR')
    document.getElementById('headerFilter').classList.remove('headerFilter')
    document.getElementById('labelSearch').style.display = 'none'
    document.getElementById('subHeaderFilter').classList.add('subHeaderFilterR')
    document.getElementById('subHeaderFilter').classList.remove('subHeaderFilter')
    document.getElementById('tableContainer').style.paddingTop = '0px';
    document.getElementById('bodyTableCurrenciesR').classList.remove('bodyTableCurrencies');
    document.getElementById('bodyTableCurrenciesR').classList.add('bodyTableCurrenciesR');
}
var interfaceC = 0;
function openMovementsModal(element){
    interfaceC = element.getAttribute('interface')
    console.log(element)
    if(element.getAttribute("id") == 0){
        document.getElementsByClassName('accountAttention')[0].style.display = "table"
    }else{
        if(element.getAttribute("interface") == 4 || element.getAttribute("interface") == 5){
            var criptoTit = document.getElementsByClassName("titCripto");
                if(criptoTit.length>0){
                    for(var i=0;i<criptoTit.length;i++){
                        criptoTit[i].getElementsByTagName("span")[0].innerHTML = element.getAttribute("icSym");
                    }
                }
            seeMovements(element.getAttribute("id"),element.getAttribute('decimals'),'BTC')
        }
        
        else if(element.getAttribute("interface") == 3){
            
        }
        
        else if(element.getAttribute("interface") == 1 || element.getAttribute("interface") == 2){
            var fiatTit = document.getElementsByClassName("titFiat");
                if(fiatTit.length>0){
                    for(var i=0;i<fiatTit.length;i++){
                        fiatTit[i].getElementsByTagName("span")[0].innerHTML = element.getAttribute("icSym");
                    }
            }
            seeMovements(element.getAttribute("id"),element.getAttribute('decimals'),'FIAT')
        }   
    }
}

function seeMovements(id,dc,type){
    var req ={
        'sessionid': getParameterByName('sessionid'),
        'accountid': id,
        'time': 0,
    }
    transactionsMovements(req,type,dc)
}

function transactionsMovements(req,type,dc){
    console.log(dc)
    console.log(req)
    callWS('GET', 'transactions/movements', req, response);
    function response(status, rsp){
        console.log('Aqui transactions/movements')
        console.log(JSON.parse(rsp));
        console.log(status)
        switch(status){
            case 200:
                if(type=='BTC'){
                    if(JSON.parse(rsp).numofrecords.length == 0){
                        document.getElementById('movBTCDeferred').innerHTML = number_format(0,dc);
                        document.getElementById('movBTCBalance').innerHTML = number_format(0,dc);
                        document.getElementById('movBTCCommitted').innerHTML = number_format(0,dc);
                        document.getElementById('movBTCTotal').innerHTML = number_format(0,dc);
                    }else{
                        document.getElementById('movBTCDeferred').innerHTML = JSON.parse(rsp).account.deferred.formatted
                        document.getElementById('movBTCBalance').innerHTML = JSON.parse(rsp).account.balance.formatted
                        document.getElementById('movBTCCommitted').innerHTML = JSON.parse(rsp).account.committed.formatted
                        document.getElementById('movBTCTotal').innerHTML= number_format(JSON.parse(rsp).account.deferred.number + JSON.parse(rsp).account.balance.number + JSON.parse(rsp).account.committed.number,
                                                                                    dc);
                    }
                    transformTransactionsMovementsBTC(JSON.parse(rsp)) 
                }else{
                    if(JSON.parse(rsp).records.length == 0){
                        document.getElementById('movVESDeferred').innerHTML = number_format(0,dc);
                        document.getElementById('movVESBalancee').innerHTML = number_format(0,dc);
                        document.getElementById('movVESCommitted').innerHTML = number_format(0,dc);
                        document.getElementById('movVESTotal').innerHTML = number_format(0,dc);
                    }else{
                        console.log(JSON.parse(rsp).account.balance.formatted)
                        document.getElementById('movVESDeferred').innerHTML = JSON.parse(rsp).account.deferred.formatted
                        document.getElementById('movVESBalancee').innerHTML = JSON.parse(rsp).account.balance.formatted
                        document.getElementById('movVESCommitted').innerHTML = JSON.parse(rsp).account.committed.formatted
                        document.getElementById('movVESTotal').innerHTML = number_format(JSON.parse(rsp).account.deferred.number + JSON.parse(rsp).account.balance.number + JSON.parse(rsp).account.committed.number,
                                                                                    dc);
                    }
                    transformTransactionsMovementsVES(JSON.parse(rsp)) 
                }
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

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);
                break;
            case 204:
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                // Error
                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 transformTransactionsMovementsBTC(data){
    dataArray = []
    console.log(data)
    for (var i = 0; i < data.numofrecords ; i++){
        if(data.records[i].status == 0){
            data.records[i].status = 'yellow'
            ////0 Pendiente, -1 Rechazado, 1 Aprobado
        }
        if(data.records[i].status == -1){
            data.records[i].status = 'red'
        }
        if(data.records[i].status == 1){
            data.records[i].status = 'green'
        }
        dataArray.push({
            'status':data.records[i].status,
            'date': data.records[i].date.formatted,
            'description': data.records[i].dsc,
            'total': data.records[i].amount.formatted,
            'id': data.records[i].id,
            'type' : data.records[i].type
        })
    }
    //listDraw(dataArray, 'dataFiat')
    listDrawDataArray(dataArray,data.account.currency.id)
    document.getElementsByClassName('movBTC')[0].style.display = "table"
    document.getElementsByTagName('body')[0].classList.add('hidden')
}

function listDrawDataArray(rsp,idCur){
    var tbl;
    var node;
    if(screen.width > 700){
        tbl = document.getElementById("imovBTC").children[0];
        var node = tbl.children[0].cloneNode(true);
        tbl.children[0].innerHTML = "";
    }else{
        document.getElementById("imovBTC").style.display = 'none'
        document.getElementById("imovBTCR").style.display = 'block'
        tbl = document.getElementById("imovBTCR").children[0];
        var node = tbl.children[0].cloneNode(true);
        tbl.children[0].innerHTML = "";
    }
    var tmp = null; tmp = node.cloneNode(true);
    tbl.innerHTML=''
    if(!(rsp.length>0)){
        var ele = null;
        ele = tmp.cloneNode(true);
        ele.style.display = "none";
        tbl.appendChild(ele);
    }else{
        for(var i=0; i<rsp.length; i++){
            var ele = null;
            ele = tmp.cloneNode(true);
            ele.style.display = "table";
            if(rsp[i].name !== ""){
                    if (rsp[i].status == 'green'){
                        ele.children[0].children[0].innerHTML = '<i class="fas fa-check-circle" style="font-size: 55%; top: -4px; position: relative; color: #85BB4F"></i>'
                    }
                    else if (rsp[i].status == 'red'){
                        ele.children[0].children[0].innerHTML = '<i class="fas fa-times-circle" style="font-size: 55%; top: -4px; position: relative; color: #C04F5D"></i>'
                    }
                    else if (rsp[i].status == 'yellow'){
                        ele.children[0].children[0].innerHTML = '<i class="fas fa-pause-circle" style="font-size: 55%; top: -4px; position: relative; color: #f2c542"></i>'
                    }
                    
                     if(screen.width > 700){
                        ele.children[0].children[1].children[0].innerHTML = rsp[i].date
                        ele.children[0].children[2].children[0].innerHTML = rsp[i].id
                        ele.children[0].children[3].children[0].innerHTML = rsp[i].description
                        ele.children[0].children[4].children[0].innerHTML = (rsp[i].total)
                            
                            // rsp[i].type == 3 -> Transferencia
                            if(rsp[i].type != 3){
                                ele.children[0].children[5].innerHTML = '<i class="fas fa-external-link-alt" style="font-size: 50%; top: -4px; position: relative; color: #4287CE; cursor: pointer"></i>'
                                ele.children[0].children[5].children[0].setAttribute("id",rsp[i].id);
                                ele.children[0].children[5].children[0].setAttribute("interface",idCur);
                                ele.children[0].children[5].children[0].addEventListener("click",function(e){
                                    console.log(e.srcElement)
                                    openBlockChainPag(e.srcElement.id,interfaceC)
                                });
                            }else{
                                ele.children[0].children[5].innerHTML = ''
                            }
 
                        if(i % 2 != 0){
                            ele.children[0].style.backgroundColor = 'rgba(245, 246, 248, 0.800000011920929)'
                        }
                        tbl.appendChild(ele);
                        if(getBrowserInfo().startsWith('Firefox')){
                            if (rsp.length >= 10){
                                document.getElementById('canBTC').style.marginRight = '18px'
                                document.getElementById('imovBTC').style.paddingRight = '10px'
                            }
                        }
                    }else{
                        ele.children[0].children[1].children[0].innerHTML = rsp[i].date + '<br>' + rsp[i].description
                        ele.children[0].children[2].children[0].innerHTML = 'TXID '+ rsp[i].id + '<br>' + (rsp[i].total)
                        
                               
                            if(rsp[i].type != 3){
                                ele.children[0].children[3].innerHTML = '<i class="fas fa-external-link-alt" style="font-size: 50%; top: -4px; position: relative; color: #4287CE; cursor: pointer"></i>'
                                ele.children[0].children[3].children[0].setAttribute("id",rsp[i].id);
                                ele.children[0].children[3].children[0].addEventListener("click",function(e){
                                    openBlockChainPag(e.srcElement.id,interfaceC)
                                });   
                            }else{
                                ele.children[0].children[5].innerHTML = ''
                            }
                        
                        if(i % 2 != 0){
                            ele.children[0].style.backgroundColor = 'rgba(245, 246, 248, 0.800000011920929)'
                        }
                        tbl.appendChild(ele);
                    }
            }
            
        }
    
    }
}

var getBrowserInfo = function() {
    var ua= navigator.userAgent, tem, 
    M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
    if(/trident/i.test(M[1])){
        tem=  /\brv[ :]+(\d+)/g.exec(ua) || [];
        return 'IE '+(tem[1] || '');
    }
    if(M[1]=== 'Chrome'){
        tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
        if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
    }
    M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
    if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
    return M.join(' ');
};

function openBlockChainPag(id,type){
    if(type == 4){
        window.open('https://www.blockchain.com/search?search='+id, '_blank');
    }else if(type == 5){
        window.open('https://explorador.petro.gob.ve/insight/transaction/'+id, '_blank');
    }
}

function transformTransactionsMovementsVES(data){
    dataArray = []
    console.log(data)
    for (var i = 0; i < data.numofrecords ; i++){
        if(data.records[i].status == 0){
            data.records[i].status = 'yellow'
            ////0 Pendiente, -1 Rechazado, 1 Aprobado
        }
        if(data.records[i].status == -1){
            data.records[i].status = 'red'
        }
        if(data.records[i].status == 1){
            data.records[i].status = 'green'
        }
        dataArray.push({
            'status':data.records[i].status,
            'date': data.records[i].date.formatted,
            'description': data.records[i].dsc,
            'total': data.records[i].amount.formatted,
            'id': data.records[i].id,
            'type': data.records[i].type
        })
    }
    listDrawDataFiat(dataArray)
    document.getElementsByClassName('movVES')[0].style.display = "table"
    document.getElementsByTagName('body')[0].classList.add('hidden')
}

function listDrawDataFiat(rsp){
    var tbl;
    var node;
        if(screen.width > 700){
            tbl = document.getElementById("imovVES").children[0];
            var node = tbl.children[0].cloneNode(true);
            tbl.children[0].innerHTML = "";
        }else{
            document.getElementById("imovVES").style.display = 'none'
            document.getElementById("imovVESR").style.display = 'block'
            tbl = document.getElementById("imovVESR").children[0];
            var node = tbl.children[0].cloneNode(true);
            tbl.children[0].innerHTML = "";
        }
    var tmp = null; tmp = node.cloneNode(true);
    tbl.innerHTML=''
    if(!(rsp.length>0)){
        var ele = null;
        ele = tmp.cloneNode(true);
        ele.style.display = "none";
        tbl.appendChild(ele);
    }else{
        for(var i=0; i<rsp.length; i++){
            var ele = null;
            ele = tmp.cloneNode(true);
            ele.style.display = "table";
            if(rsp[i].name !== ""){
                    if (rsp[i].status == 'green'){
                        ele.children[0].children[0].innerHTML = '<i class="fas fa-check-circle" style="font-size: 55%; top: -4px; position: relative; color: #85BB4F"></i>'
                    }
                    else if (rsp[i].status == 'red'){
                        ele.children[0].children[0].innerHTML = '<i class="fas fa-times-circle" style="font-size: 55%; top: -4px; position: relative; color: #C04F5D"></i>'
                    }
                    else if (rsp[i].status == 'yellow'){
                        ele.children[0].children[0].innerHTML = '<i class="fas fa-pause-circle" style="font-size: 55%; top: -4px; position: relative; color: #f2c542"></i>'
                    }
                    if(screen.width > 700){
                        ele.children[0].children[1].children[0].innerHTML = rsp[i].date
                        ele.children[0].children[1].children[0].setAttribute("date",rsp[i].date);
                        ele.children[0].children[2].children[0].innerHTML = rsp[i].description
                        ele.children[0].children[3].children[0].innerHTML = (rsp[i].total)
                        ele.children[0].children[3].children[0].setAttribute("total",rsp[i].date);
                            ele.children[0].children[4].innerHTML = '<i class="fas fa-eye tableMovEye"></i>'
                            ele.children[0].children[4].children[0].setAttribute("id",rsp[i].id);
                            ele.children[0].children[4].children[0].addEventListener("click",function(e){
                                openMovDetailFiat(e.srcElement.id)
                            });
                        
                        if(i % 2 != 0){
                            ele.children[0].style.backgroundColor = 'rgba(245, 246, 248, 0.800000011920929)'
                        }
                        
                        tbl.appendChild(ele);
                        if(getBrowserInfo().startsWith('Firefox')){
                            if (rsp.length >= 10){
                                document.getElementById('amountVES').style.marginRight = '18px'
                                document.getElementById('imovVES').style.paddingRight = '15px'
                                document.getElementById('datVES').parentNode.style.width = '29%'
                            }
                        }
                        
                        if(getBrowserInfo().startsWith('Chrome')){
                            document.getElementById('datVES').parentNode.style.width = "29%"
                            if (rsp.length >= 10){
                                document.getElementById('amountVES').style.marginRight = '22px'
                                document.getElementById('imovVES').style.paddingRight = '10px'
                            }
                        }
                    }else{
                        ele.children[0].children[1].children[0].innerHTML = rsp[i].date + '<br>' + rsp[i].description
                        ele.children[0].children[2].children[0].innerHTML = (rsp[i].total)
                        if(rsp[i].description == "Retiro" || 
                           rsp[i].description == "Comisión de Retiro" || 
                           rsp[i].description == "Transferencia" || 
                           rsp[i].description == "Comisión de Transferencia" || 
                           rsp[i].description == "Depósito inicial de pruebas" || 
                           rsp[i].description == "Comisión de Depósito inicial de pruebas" || 
                           rsp[i].description == "Transferencia" || 
                           rsp[i].description == "Comisión de Transferencia" ||
                           rsp[i].description == "Depósito" || 
                           rsp[i].description == "Comisión de Depósito"){
                            ele.children[0].children[3].innerHTML = '<i class="fas fa-eye tableMovEye"></i>'
                            ele.children[0].children[3].children[0].setAttribute("id",rsp[i].id);
                            ele.children[0].children[3].children[0].addEventListener("click",function(e){
                                openMovDetailFiat(e.srcElement.id)
                            });
                        }else{
                            ele.children[0].children[3].innerHTML = ''
                        }
                        
                        if(i % 2 != 0){
                            ele.children[0].style.backgroundColor = 'rgba(245, 246, 248, 0.800000011920929)'
                        }
                        tbl.appendChild(ele);
                    }

            }
            
        }
    
    }
}

function openMovDetailFiat(id){
    console.log(id)
    var req ={
        'sessionid': getParameterByName('sessionid'),
        'id': id,
        'time': 0,
    }
    
    transactionsEntry(req)
}

// transacionts/entry

function transactionsEntry(req){
    console.log(req)
    callWS('GET', 'transactions/entry', req, response);
    function response(status, rsp){
        switch(status){
            case 200:
                /*MODIFICADO*/
                var trans = JSON.parse(rsp).entry;
                var amount = trans.amount.formatted;
                var total = trans.total.formatted;
                var fee = trans.fee.formatted;
                console.log(trans);
                if (trans.origin){
                    document.getElementById('movDetailFiatAddress').style.display = 'table';
                    document.getElementById('movDetailFiatAddressHr').style.display = 'block';
                    document.getElementById('movDetailFiatAddress').style.display = 'table';
                    document.getElementById('movDetailFiatAddressHr').style.display = 'block';
                    document.getElementById('movDetailFiatAddress').style.display = 'table';
                    document.getElementById('movDetailFiatAddressHr').style.display = 'block';
                    document.getElementById('movDetailFiatAccount').innerHTML = this.transformAccountString(JSON.parse(rsp).entry.destination.account.paymentmethod.dsc,JSON.parse(rsp).entry.destination.account.details1)
                    document.getElementById("movDetailTit").innerHTML = getLangById("withdrawLine")[lang] + trans.origin.account.currency.symbol; 
                    /*
                    if(valid !== null)document.getElementById("resend").style.display = "";
                    else document.getElementById("resend").style.display = "none";*/
                    document.getElementById("resend").parentElement.parentElement.style.display = "none";
                    
                    /*if(JSON.parse(rsp).entry.destination.account.details1){
                        
                    }else{
                        console.log(JSON.parse(rsp).entry.destination.account.details1)
                        document.getElementById('movDetailFiatAddress').style.display = 'none';
                        document.getElementById('movDetailFiatAddressHr').style.display = 'none';
                        document.getElementById('movDetailFiatAccount').innerHTML = '';
                        document.getElementById("movDetailTit").innerHTML = "Retiro "+ trans.destination.account.currency.symbol; 
                        document.getElementById("resend").parentElement.parentElement.style.display = "none";

                    }     */               
                    document.getElementById('movDetailFiatAmount').innerHTML = total;
                    document.getElementById('movDetailFiatAmountRet').innerHTML = amount;
                    document.getElementById('comisionFiatDetails').innerHTML = fee;
                    document.getElementById('movDetailFiatDate').innerHTML = JSON.parse(rsp).entry.datecreated.formatted;
                    document.getElementById('movDetailFiatSeeComprobant').setAttribute("comp",JSON.parse(rsp).entry.payment.url);
                    document.getElementsByClassName('movDetailFiat')[0].style.display = "table";
                    document.getElementsByClassName('movVES')[0].style.display = "none";
                    document.getElementById('movDetailLblAmount').innerHTML = getLangById("amountWithdrawn")[lang]; 

                }else if(trans.destination){
                        document.getElementById("movDetailTit").innerHTML = getLangById("depositLine")[lang]  + trans.destination.account.currency.symbol; 

                        document.getElementById('movDetailFiatAddress').style.display = 'table';
                        document.getElementById('movDetailFiatAddressHr').style.display = 'block';
                        document.getElementById('movDetailFiatAccount').innerHTML = this.transformAccountString(JSON.parse(rsp).entry.destination.account.paymentmethod.dsc,JSON.parse(rsp).entry.destination.account.details1)
                        document.getElementById("resend").parentElement.parentElement.style.display = "table";
                    /*}else{
                        console.log(JSON.parse(rsp).entry.destination.account.details1)
                        document.getElementById('movDetailFiatAddress').style.display = 'none';
                        document.getElementById('movDetailFiatAddressHr').style.display = 'none';
                        document.getElementById('movDetailFiatAccount').innerHTML = '';
                        document.getElementById("movDetailTit").innerHTML = "COMISIÓN DE DEPOSIO";
                        document.getElementById("resend").parentElement.parentElement.style.display = "none";
                    }*/
                    document.getElementById('movDetailLblAmount').innerHTML = getLangById("amountDeposit")[lang] ; 
                    document.getElementById('movDetailFiatDate').innerHTML = JSON.parse(rsp).entry.datecreated.formatted;
                    document.getElementById('movDetailFiatAmount').innerHTML = total;
                    document.getElementById('movDetailFiatAmountRet').innerHTML = amount;
                    document.getElementById('comisionFiatDetails').innerHTML = fee;
                    document.getElementById('movDetailFiatSeeComprobant').setAttribute("comp",JSON.parse(rsp).entry.payment.url);
                    document.getElementsByClassName('movDetailFiat')[0].style.display = "table";
                    document.getElementsByClassName('movVES')[0].style.display = "none";
                    
                }
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function transformAccountString(paymentmethod, details1){
    return(paymentmethod + '(****' + details1.substr(-4) + ')')
}

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('titleBalance','balanceSheet');
    setWordLanginnerHTML('labelSearch','search');
    setWordLanginnerHTML('currencyLabelMov','currency');
    setWordLanginnerHTML('balanceLabelMov','balance');
    setWordLanginnerHTML('lastOperationLabelMov','lastOperation');
    setWordLanginnerHTML('percentagesLabelMov','percentages');
    setWordLanginnerHTML('expressedInLabelMov','expressedIn');
    setWordLanginnerHTML('trasnferLabelMov','transfer');
    setWordLanginnerHTML('depositLabelMov','deposit');
    setWordLanginnerHTML('withdrawLabelMov','withdraw');
    setWordLanginnerHTML('currencyLabelMovR','currency');
    setWordLanginnerHTML('balanceLabelMovR','balance');
    setWordLanginnerHTML('lastOperationMovR','lastOperation');
    setWordLanginnerHTML('percentageMovR','percentages');
    setWordLanginnerHTML('expressedInLabelMovR','expressedInR');
    setWordLanginnerHTML('expressInRMov','expressedInRTable');
    setWordLanginnerHTML('ts','ts');
    setWordLanginnerHTML('completeLater','completeLater');
    setWordLanginnerHTML('completeLaterAccept','completeThen');
    setWordLanginnerHTML('completeLaterCancel','cancel');
    setWordLanginnerHTML('expired1','expired1');
    setWordLanginnerHTML('expired2','expired2');
    setWordLanginnerHTML('expSessionButton','continue')
    setWordLanginnerHTML('MovLabelBTC','movementsSpan');
    setWordLanginnerHTML('statBTC','status');
    setWordLanginnerHTML('datBTC','date');
    setWordLanginnerHTML('desBTC','description');
    setWordLanginnerHTML('canBTC','quantity');
    setWordLanginnerHTML('AvaMovLabel','AVAILABLE');
    setWordLanginnerHTML('defMovLabel','DEFERRED');
    setWordLanginnerHTML('comMovLabel','COMMITTED');
    setWordLanginnerHTML('movBTCBack','BACK');
    setWordLanginnerHTML('LabelFiatMov','movementsSpan');
    setWordLanginnerHTML('fiatLabelMov','status');
    setWordLanginnerHTML('datVES','date');
    setWordLanginnerHTML('fiatLabelDes','description');
    setWordLanginnerHTML('amountVES','quantity');
    setWordLanginnerHTML('AvaMovLabelF','AVAILABLE');
    setWordLanginnerHTML('defMovLabelF','DEFERRED');
    setWordLanginnerHTML('comMovLabelF','COMMITTED');
    setWordLanginnerHTML('movVESBack','BACK');
    setWordLanginnerHTML('comisionFiatDetailsLabel','fees');
    setWordLanginnerHTML('movDetailFiatAmountLabel','netTotal');
    setWordLanginnerHTML('movDetailFiatAccountLabel','destinationAccount');
    setWordLanginnerHTML('movDetailFiatDateLabel','date');
    setWordLanginnerHTML('resend','seeVoucher');
    setWordLanginnerHTML('detailFiatButton','TOACCEPT');
    setWordLanginnerHTML('accountAttentionTitle','attention');
    setWordLanginnerHTML('amountValidationText','notHaveAcc');
    setWordLanginnerHTML('acceptNoAccount','TOACCEPT');
    
    getEntry(getParameterByName('sessionid'));

}






