function start(){    
    document.getElementById('cancel-button').addEventListener("click", function(){
        gotoPage('login','main','');
    }); 
    
    document.getElementById('accept-button').addEventListener("click", function(){
        var scroll = document.getElementsByClassName('scroll-box')[0];
        if(scroll.scrollTop >= scroll.scrollHeight - scroll.offsetHeight - 20){
            gotoPage('register','register-data','');
        }else{
            document.getElementById('e').innerHTML = getLangById('required')[lang];
        }
    }); 
    
    document.getElementById('termdown').addEventListener("click", function(){
        gotoNewPage('register','termsandconditions')
    }); 
    
    setLang()
}

function termsLoad(){
    callWS("GET", "terms/load", { "lang": lang } , response);
        
    function response(status, rsp){
        switch(status){
            case 200:
                document.getElementById('text').innerHTML = JSON.parse(rsp).terms
                break;
            default:
                break;
        }
    }    
}

function setLang(){
    
    lang = lang = sessionStorage.getItem('lang') ? lang = sessionStorage.getItem('lang') : 'esp';
    
    addFooter()
    
    /* inner HTML */
    setWordLanginnerHTML('register','register');
    setWordLanginnerHTML('register1','register1');
    setWordLanginnerHTML('register2','register2');
    setWordLanginnerHTML('register3','register3');
    setWordLanginnerHTML('register4','register4');
    setWordLanginnerHTML('registerTitle','register1');
    setWordLanginnerHTML('cancel-button','cancel');
    setWordLanginnerHTML('accept-button','accept');

    setWordLanginnerHTML('ts','ts');
    
    termsLoad()

    //Mostrar HTML cargado
    esconderHTML(false);   
}