WS_waitscreen = true;
var requiredLevelData = [];

window.onload = function(){
    
    getCountries()
    // Call Entry
    
    // Go to Back
    document.getElementById('previous-button').addEventListener("click", function(){
        gotoPage('register','regC', { 'sessionid' : getParameterByName('sessionid') })
    });
    
    // Go to Register Partner Data
    document.getElementById('next-button').addEventListener("click", function(){
        verifyData()
    });
    
    // Select Country
    /*document.getElementById('country').addEventListener("change", function(){
        getPhoneCode(document.getElementById('country').value)
    });*/
    
    // Later
    document.getElementById('later-button').addEventListener("click", function(){
        document.getElementsByClassName('completeLater')[0].style.display = 'table'
    });
    
    document.getElementById('completeLaterAccept').addEventListener("click", function(){
        gotoPage('dashboard','home', { 'sessionid' : getParameterByName('sessionid') })
    });
    
    document.getElementById('completeLaterCancel').addEventListener("click", function(){
        document.getElementsByClassName('completeLater')[0].style.display = 'none'
    });
    now = new Date();
    nowDate = now.getFullYear() + '-' + (now.getMonth()+1) + '-' + now.getDate()
    
    // Change values where
    document.getElementById('country').addEventListener("change", function(){
        if (idCountry != document.getElementById('country').value){
            idCountry = document.getElementById('country').value
            getRegions('','')
            removeOptions('city')
            var selector = document.getElementsByName('city')[0];
            var firstOopcion = document.createElement("option");
            firstOopcion.disabled = true;
            firstOopcion.text = lang == "esp" ? 'Selecciona' : 'Select'
            firstOopcion.value =''
            firstOopcion.selected = true
            selector.add(firstOopcion)
        }
    });
    document.getElementById('state').addEventListener("change", function(){
        if (idState != document.getElementById('state').value){
            idState = document.getElementById('country').value
            getCities('','')
        }
    });
    
    var countries;
    
    // Number format
    /*var number = document.getElementById('numberId');
    number.addEventListener('keyup', function() {
        numberFormat(number,number.value.charAt(number.value.length-1));
    });*/
    
    // Remove red errors 
    document.getElementsByTagName('body')[0].addEventListener("click", function(){
        if (document.getElementById('typeCompany').value !== ''){
            noError('typeCompany','etypeCompany')
            document.getElementById('etypeCompany').style.display = 'none'
        }
        if (document.getElementById('numberIdAlt').value !== ''){
            noError('numberIdAlt','enumberIdAlt')
            document.getElementById('enumberIdAlt').style.display = 'none'
        }
        if (document.getElementById('socialReason').value !== ''){
            noError('socialReason','esocialReason')
            document.getElementById('esocialReason').style.display = 'none'
        }
        if (document.getElementById('creationDate').value !== '' && now.getTime() >= new Date(document.getElementById('creationDate').value).getTime()){
            noError('creationDate','ecreationDate')
            document.getElementById('ecreationDate').style.display = 'none'
        }
        if (document.getElementById('country').value !== ''){
            noError('country','ecountry')
            document.getElementById('ecountry').style.display = 'none'
        }
        if (document.getElementById('state').value !== ''){
            noError('state','estate')
            document.getElementById('estate').style.display = 'none'
        }
        if (document.getElementById('city').value !== ''){
            noError('city','ecity')
            document.getElementById('ecity').style.display = 'none'
        }
        if (document.getElementById('postalCode').value !== ''){
            noError('postalCode','epostalCode')
            document.getElementById('epostalCode').style.display = 'none'
        }
        if (document.getElementById('phone').value !== ''){
            noError('phone','ephone')
            document.getElementById('ephone').style.display = 'none'
        }
        if (document.getElementById('numberpartners').value !== '0'){
            noError('numberpartners','enumberpartners')
            document.getElementById('enumberpartners').style.display = 'none'
        }
        if (document.getElementById('venezuelan').value !== ''){
            noError('venezuelan','evenezuelan')
            document.getElementById('evenezuelan').style.display = 'none'
        }
    }); 
    
    // Session Update
    document.getElementById('expSessionButton').addEventListener("click",function(){
        var req = {
            'sessionid': getParameterByName('sessionid')
        }
        sessionUpdate(req)
    })
    
    
    //Mostrar HTML cargado
    esconderHTML(false);
}

var idCountry = '';
var idState = '';
var idCity = ''
var entrydata;
function getEntry(sessionid){
    callWS("GET", "users/entry", { 'sessionid' : sessionid}, response);
        
    function response(status, rsp){
        switch(status){
            case 200:
                entrydata = JSON.parse(rsp)
                requiredLevelData = JSON.parse(rsp).requiredLevel ? (JSON.parse(rsp).requiredLevel).split(',') : []
                levels = JSON.parse(rsp).entry.levels
                console.log(requiredLevelData)
                console.log(entrydata)
                
                if (JSON.parse(rsp).entry.company.type.id == 0){
                    document.getElementById('typeCompany').value = ''
                }else{
                    document.getElementById('typeCompany').value = JSON.parse(rsp).entry.company.type.id
                }
                setStatus('typeCompanyIcon',JSON.parse(rsp).entry.company.type,'typeCompany')
                
                document.getElementById('numberIdAlt').value = JSON.parse(rsp).entry.company.document.dsc.value
                setStatus('numberIdAltIcon',JSON.parse(rsp).entry.company.document.dsc,'numberIdAlt')
            
                document.getElementById('socialReason').value = JSON.parse(rsp).entry.company.name.value
                setStatus('socialReasonIcon',JSON.parse(rsp).entry.company.name,'socialReason')
                
                document.getElementById('comercialNameAlt').value = JSON.parse(rsp).entry.company.comercialname.value
                setStatus('comercialNameAltIcon',JSON.parse(rsp).entry.company.comercialname,'comercialNameAlt')
                
                if (JSON.parse(rsp).entry.company.datecreated.date.substr(0,10) == '1970-01-01'){
                    document.getElementById('creationDate').value = ''
                }else{
                    document.getElementById('creationDate').value = JSON.parse(rsp).entry.company.datecreated.date.substr(0,10)
                }
                setStatus('creationDateIcon',JSON.parse(rsp).entry.company.datecreated,'creationDate')
                
                if (JSON.parse(rsp).entry.company.document.country.id == null){
                    document.getElementById('country').value = ''
                }else{
                    document.getElementById('country').value = JSON.parse(rsp).entry.company.document.country.id
                }
                setStatus('countryIcon',JSON.parse(rsp).entry.company.document.country,'country')
                
                if (JSON.parse(rsp).entry.company.document.region.id==null){
                    document.getElementById('state').value = ''
                }else{
                    document.getElementById('state').value = JSON.parse(rsp).entry.company.document.region.id
                }
                setStatus('stateIcon',JSON.parse(rsp).entry.company.document.region,'state')
                
                if (JSON.parse(rsp).entry.company.document.city.id==null){
                    document.getElementById('city').value = ''
                }else{
                    document.getElementById('city').value = JSON.parse(rsp).entry.company.document.city.id
                }
                setStatus('cityIcon',JSON.parse(rsp).entry.company.document.city,'city')

                if(JSON.parse(rsp).entry.company.venezuelan.value === null || JSON.parse(rsp).entry.company.venezuelan.value === '' ){
                    document.getElementById('venezuelan').value = ''
                }else{
                    document.getElementById('venezuelan').value = JSON.parse(rsp).entry.company.venezuelan.value
                }
                setStatus('venezuelanIcon',JSON.parse(rsp).entry.company.venezuelan,'venezuelan')
                
                document.getElementById('postalCode').value = JSON.parse(rsp).entry.company.document.postalcode.value
                setStatus('postalCodeIcon',JSON.parse(rsp).entry.company.document.postalcode,'postalCode')
                
                document.getElementById('phone').value = JSON.parse(rsp).entry.company.phone.value
                setStatus('phoneIcon',JSON.parse(rsp).entry.company.phone,'phone')
                
                document.getElementById('web').value = JSON.parse(rsp).entry.company.website.value
                setStatus('webIcon',JSON.parse(rsp).entry.company.website,'web')
                
                document.getElementById('numberpartners').value = JSON.parse(rsp).entry.company.partnersnumber.value
                setStatus('numberpartnersIcon',JSON.parse(rsp).entry.company.partnersnumber,'numberpartners')
                
                if(JSON.parse(rsp).entry.company.document.region.id!=null && JSON.parse(rsp).entry.company.document.region.id!='' ){
                    getRegions(JSON.parse(rsp).entry.company.document.region.id,JSON.parse(rsp).entry.company.document.city.id)
                }
                
                setLevels(levels)
                
                document.getElementsByClassName('pageCnt')[0].style.visibility="visible"
                // Window Load
                var waitScreen = document.getElementById("waitScreen");
                document.body.removeChild(waitScreen);
                WS_waitscreen = false;
                break;
            case 204:
                break;
            case 400:
                // Parametros incorrectos
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                // Error
                break;
            default:
                break;
        }
    }    
}
function getCountries(){
    var req = {
        "sessionid": getParameterByName('sessionid')
    }
        
    callWS("GET", "demographics/countries", req, response);
        
    function response(status, rsp){
        switch(status){
            case 200:
                countries = JSON.parse(rsp);
                addOptions("country", countries,true)
                break;
            case 204:
                break;
            case 400:
                // Parametros incorrectos
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                // Error
                break;
            default:
                break;
        }
    }    
}

function getRegions(selR,selC){
    removeOptions('state')
    var req = {
        "sessionid": getParameterByName('sessionid'),
        "countryid": document.getElementsByName('country')[0].value
    }
     if ( req.countryid != ''){
        callWS("GET", "demographics/regions", req, response);
        function response(status, rsp){
            switch(status){
                case 200:
                    states = JSON.parse(rsp);
                    addOptions("state", states,false);
                    if(selR!=''){
                        setTimeout(function(){ document.getElementById('state').value = selR}, 500);
                        if(selC!=''){
                            setTimeout(function(){ getCities(selR,selC)}, 500);
                        }
                    }
                    //Timeout 500
                    //sel esta es la seleccionada setear
                    //getEntry(getParameterByName('sessionid'))
                    break;
                case 204:
                    break;
                case 400:
                    // Parametros incorrectos
                    break;
                case 401:
                    expiredSession();
                    break;
                case 500:
                    // Error
                    break;
                default:
                    break;
            }
        }     
    }
        
}

function removeOptions(selectElement) {
    x = document.getElementById(selectElement)
    var i, L = x.options.length - 1;
    for(i = L; i >= 0; i--) {
       x.remove(i);
    }
}

function getCities(selR,selC){
    removeOptions('city')
    var req = {
        "sessionid": getParameterByName('sessionid'),
        "regionid": document.getElementsByName('state')[0].value
    }
     if ( req.regionid != ''){
        callWS("GET", "demographics/cities", req, response);
        function response(status, rsp){
            switch(status){
                case 200:
                    cities = JSON.parse(rsp);
                    addOptions("city", cities,false)
                    if(selC!=''){
                        setTimeout(function(){ document.getElementById('city').value = selC}, 500);
                    }
                    break;
                case 204:
                    break;
                case 400:
                    // Parametros incorrectos
                    break;
                case 401:
                    expiredSession();
                    break;
                case 500:
                    // Error
                    break;
                default:
                    break;
            }
        }     
    }
        
}



function addOptions(domElement, array,bool) { 
    var selector = document.getElementsByName(domElement)[0];
    var firstOopcion = document.createElement("option");
    firstOopcion.disabled = true;
    firstOopcion.text = lang == "esp" ? 'Selecciona' : 'Select'
    firstOopcion.value =''
    firstOopcion.selected = true
    selector.add(firstOopcion);
    for (var countrie in array.records) {
        if (array.records[countrie].id > 0){
            var opcion = document.createElement("option");
            opcion.text = array.records[countrie].dsc;
            opcion.value = array.records[countrie].id
            selector.add(opcion);     
        }
    }
    if(bool== true){
        setLang()
    }
}


function getPhoneCode(number){
    var req = {
        "sessionid": getParameterByName('sessionid')
    }
        
    callWS("GET", "demographics/countries", req, response);
        
    function response(status, rsp){
        switch(status){
            case 200:
                countries = JSON.parse(rsp);
                document.getElementById('phone').value = countries.records[number].areacode
                break;
            case 204:
                break;
            case 400:
                // Parametros incorrectos
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                // Error
                break;
            default:
                break;
        }
    }    
}

function numberFormat(donde,caracter){
    pat = /[\*,\+,\(,\),\?,\\,\$,\[,\],\^]/
    valor = donde.value
    largo = valor.length
    crtr = true
    if(isNaN(caracter) || pat.test(caracter) == true)
    	{
    	if (pat.test(caracter)==true) 
    		{caracter = "\\" + caracter}
    	carcter = new RegExp(caracter,"g")
    	valor = valor.replace(carcter,"")
    	donde.value = valor
    	crtr = false
    	}
    else
    	{
    	var nums = new Array()
    	cont = 0
    	for(m=0;m<largo;m++)
    		{
    		if(valor.charAt(m) == "." || valor.charAt(m) == " ")
    			{continue;}
    		else{
    			nums[cont] = valor.charAt(m)
    			cont++
    			}
    		}
    	}
    var cad1="",cad2="",tres=0
    if(largo > 3 && crtr == true)
    	{
    	for (k=nums.length-1;k>=0;k--)
    		{
    		cad1 = nums[k]
    		cad2 = cad1 + cad2
    		tres++
    		if((tres%3) == 0)
    			{
    			if(k!=0){
    				cad2 = "." + cad2
    				}
    			}
    		}
    	 donde.value = cad2
    	}
}	

function verifyData(){
    
    var companytype = document.getElementById('typeCompany');
    var doc = document.getElementById('numberIdAlt');
    var name = document.getElementById('socialReason');
    var comercialname = document.getElementById('comercialNameAlt');
    var creationdate = document.getElementById('creationDate');
    var doccountryid = document.getElementById('country');
    var docregionid = document.getElementById('state');
    var doccityid = document.getElementById('city');
    var postalcode = document.getElementById('postalCode');
    var phone = document.getElementById('phone');
    var website = document.getElementById('web');
    var partners = document.getElementById('numberpartners');
    var venezuelan = document.getElementById('venezuelan');
    
    var req = {
        "sessionid" : getParameterByName('sessionid'),
        "companytype": companytype.value,
        "doc" : doc. value,
        "name": capitalize(name.value),
        "comercialname" : capitalize(comercialname.value),
        "creationdate": creationdate.value,
        "doccountryid" : doccountryid. value,
        "docregionid": docregionid.value,
        "doccityid" : doccityid. value,
        "postalcode": postalcode.value,
        "phone" : phone.value,
        "website": website.value,
        "partners" : partners.value,
        "venezuelan" : venezuelan.value,
        "step" : 1
    }
    
    now = new Date();
    nowDate = now.getFullYear() + '-' + (now.getMonth()+1) + '-' + now.getDate()
    
    if( ( companytype.value=='' && requiredLevelData.includes(companytype.getAttribute('dataname')) ) ||
        ( doc.value=='' && requiredLevelData.includes(doc.getAttribute('dataname')) ) ||
        ( name.value=='' && requiredLevelData.includes(name.getAttribute('dataname')) ) ||
        ( creationdate.value=='' && requiredLevelData.includes(creationdate.getAttribute('dataname')) ) ||
        ( doccountryid.value=='' && requiredLevelData.includes(doccountryid.getAttribute('dataname')) ) ||
        ( docregionid.value=='' && requiredLevelData.includes(docregionid.getAttribute('dataname')) ) ||
        ( doccityid.value=='' && requiredLevelData.includes(doccityid.getAttribute('dataname')) ) ||
        ( postalcode.value=='' && requiredLevelData.includes(postalcode.getAttribute('dataname')) ) ||
        ( phone.value=='' && requiredLevelData.includes(phone.getAttribute('dataname')) ) ||
        ( partners.value=='0' && requiredLevelData.includes(partners.getAttribute('dataname')) ) ||
        ( venezuelan.value=='' && requiredLevelData.includes(venezuelan.getAttribute('dataname')) ) ||
        now.getTime() < new Date(creationdate.value).getTime() ){
        if (companytype.value=='' && requiredLevelData.includes(companytype.getAttribute('dataname'))){
            error('typeCompany','etypeCompany',getLangById("usersUpdatecompany1")[lang]);
            document.getElementById('etypeCompany').style.display = 'block'
        }
        if (now.getTime() < new Date(creationdate.value).getTime()){
            error('creationDate','ecreationDate',getLangById("usersUpdatecompany2")[lang]);
            document.getElementById('ecreationDate').style.display = 'block'
        }
        if(venezuelan.value=='' && requiredLevelData.includes(venezuelan.getAttribute('dataname'))){
            error('venezuelan','evenezuelan',getLangById("usersUpdatecompany3")[lang]);
            document.getElementById('evenezuelan').style.display = 'block'
        }
        if(doc.value=='' && requiredLevelData.includes(doc.getAttribute('dataname'))){
            error('numberIdAlt','enumberIdAlt',getLangById("usersUpdatecompany4")[lang]);
            document.getElementById('enumberIdAlt').style.display = 'block'
        } 
        if(name.value=='' && requiredLevelData.includes(name.getAttribute('dataname'))){
            error('socialReason','esocialReason',getLangById("usersUpdatecompany5")[lang]);
            document.getElementById('esocialReason').style.display = 'block'
        }
        if(creationdate.value=='' && requiredLevelData.includes(creationdate.getAttribute('dataname'))){
            error('creationDate','ecreationDate',getLangById("usersUpdatecompany6")[lang]);
            document.getElementById('ecreationDate').style.display = 'block'
        }
        if(doccountryid.value=='' && requiredLevelData.includes(doccountryid.getAttribute('dataname'))){
            error('country','ecountry',getLangById("usersUpdatecompany7")[lang]);
            document.getElementById('ecountry').style.display = 'block'
        }
        if(docregionid.value=='' && requiredLevelData.includes(docregionid.getAttribute('dataname'))){
            error('state','estate',getLangById("usersUpdatecompany8")[lang]);
            document.getElementById('estate').style.display = 'block'
        }
         if(doccityid.value=='' && requiredLevelData.includes(doccityid.getAttribute('dataname'))){
            error('city','ecity',getLangById("usersUpdatecompany9")[lang]);
            document.getElementById('ecity').style.display = 'block'
        }
        if(postalcode.value=='' && requiredLevelData.includes(postalcode.getAttribute('dataname'))){
            error('postalCode','epostalCode',getLangById("usersUpdatecompany10")[lang]);
            document.getElementById('epostalCode').style.display = 'block'
        }
        if(phone.value=='' && requiredLevelData.includes(phone.getAttribute('dataname'))){
            error('phone','ephone',getLangById("usersUpdatecompany11")[lang]);
            document.getElementById('ephone').style.display = 'block'
        }
        if(partners.value==0 && requiredLevelData.includes(partners.getAttribute('dataname'))){
            error('numberpartners','enumberpartners',getLangById("usersUpdatecompany12")[lang]);
            document.getElementById('enumberpartners').style.display = 'block'
        }
        return;    
        
    }else{
        updateCompany(req);
    }
}

function updateCompany(req){
    
    if(entrydata.entry.company.step == '1'){
        req.uploadids = null
    }
    console.log(req)
    callWS("POST", "users/updatecompany", req, response);
    function response(status, rsp){
        console.log(status)
        console.log(rsp)
        switch(status){
            case 200:
                // Ok
                console.log(req)
                gotoPage('register','regCompanyPartner', { 'sessionid' : getParameterByName('sessionid') })
                break;
            case 204:
                break;
            case 400:
                // Parametros incorrectos
            case 409:
                // Registro duplicado
                error('numberIdAlt','enumberIdAlt',getLangById("usersUpdatecompany409")[lang]);
                document.getElementById('enumberIdAlt').style.display = 'block'
                break;
            case 401:
                expiredSession();
                break;
            case 500:
                // Error
                break;
            default:
                break;
        }
    }  
}

// name A: classIcon
// name B : BD
// nameC: nameInput
function setStatus(nameA,nameB,nameC){
    
    document.getElementById(nameC).setAttribute('dataname',nameB.update)
                
    if(nameB.valid == -1){
        document.getElementById(nameA).classList.add("iconRed")
        document.getElementById(nameA).classList.add("fas")
        document.getElementById(nameA).classList.add("fa-times-circle")
    }
    else if (nameB.valid == 0){
        document.getElementById(nameA).classList.add("iconYellow")
        document.getElementById(nameA).classList.add("fas")
        document.getElementById(nameA).classList.add("fa-pause-circle")
    }
    else if (nameB.valid == 1){
        document.getElementById(nameA).classList.add("iconGreen")
        document.getElementById(nameA).classList.add("fas")
        document.getElementById(nameA).classList.add("fa-check-circle")
        document.getElementById(nameC).disabled = true;
        document.getElementById(nameC).style.cursor = 'default'
        if(document.getElementById(nameC).tagName != 'SELECT'){
            document.getElementById(nameC).style.backgroundColor = 'white'
        }
    }
    document.getElementById(nameC).classList.add("inputElement")
}

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"
                break;
            case 400:
                break;
            case 401:
                expiredSession();
                break;
            case 402:
                break;
            case 403:
                break;
            case 500:
                break;
            default:
                break;
        }
    }   
}

function setLevels(levels){
    console.log(levels)
    levels1 = levels[1].basicRequired.split(',')
    levels2 = levels[2].basicRequired.split(',')
    levels3 = levels[3].basicRequired.split(',')
    console.log(document.getElementsByClassName('inputElement'))
    console.log(document.getElementsByClassName('inputElement').length)
    for(var i = 0; i < document.getElementsByClassName('inputElement').length ; i++){
        if(levels1.includes(document.getElementsByClassName('inputElement')[i].getAttribute('dataname'))){
            if(!document.getElementsByClassName('inputElement')[i].previousElementSibling.children[0]){
                document.getElementsByClassName('inputElement')[i].previousElementSibling.innerHTML += '<span style="font-size: 90%; color: #7D8B9E;" class="roboto-bold"> (1) </span>'   
            }
        }
        else if(levels2.includes(document.getElementsByClassName('inputElement')[i].getAttribute('dataname'))){
            if(!document.getElementsByClassName('inputElement')[i].previousElementSibling.children[0]){
                document.getElementsByClassName('inputElement')[i].previousElementSibling.innerHTML += '<span style="font-size: 90%; color: #4287CE;" class="roboto-bold"> (2) </span>'   
            }
        }
        else if(levels3.includes(document.getElementsByClassName('inputElement')[i].getAttribute('dataname'))){
            if(!document.getElementsByClassName('inputElement')[i].previousElementSibling.children[0]){
                document.getElementsByClassName('inputElement')[i].previousElementSibling.innerHTML += '<span style="font-size: 90%; color: rgb(1, 42, 63);" class="roboto-bold"> (3) </span>'
            }
        }
    }
}

function setLang(){
    
    lang = localStorage.getItem('lang');
    
    /* inner HTML */
    setWordLanginnerHTML('regcompany1','regcompany1');
    setWordLanginnerHTML('regcompany2','regcompany2');
    setWordLanginnerHTML('regcompany3','regcompany3');
    setWordLanginnerHTML('regcompany4','regcompany4');
    setWordLanginnerHTML('regcompany5','regcompany5');
    setWordLanginnerHTML('regcompany6','regcompany6');
    setWordLanginnerHTML('regcompany7','regcompany7');
    setWordLanginnerHTML('regTitle','regcompany1');
    setWordLanginnerHTML('venezuelanLabel','venezuelanLabel');
    setWordLanginnerHTML('companyTypeLabel','companyType');
    setWordLanginnerHTML('numberIdLabel','numberId');
    setWordLanginnerHTML('socialReasonLabel','businessName');
    setWordLanginnerHTML('comercialNameLabel','comercialName');
    setWordLanginnerHTML('comercialNameOptional','optional');
    setWordLanginnerHTML('creationDateLabel','creationDate');
    setWordLanginnerHTML('countryLabel','countryLabel');
    setWordLanginnerHTML('registrationStatusLabel','registrationStatus');
    setWordLanginnerHTML('SelectStat','select');
    setWordLanginnerHTML('cityLabel','city');
    setWordLanginnerHTML('SelCity','select');
    setWordLanginnerHTML('postalCodeLabel','postalCode');
    setWordLanginnerHTML('phoneLabel','phone');
    setWordLanginnerHTML('webLabel','website');
    setWordLanginnerHTML('optionalWeb','optional');
    setWordLanginnerHTML('numberpartnersLabel','numberPartners');
    setWordLanginnerHTML('selNumberPartners','select');
    setWordLanginnerHTML('requiredLevel1','requiredLevel1');
    setWordLanginnerHTML('requiredLevel2','requiredLevel2');
    setWordLanginnerHTML('requiredLevel3','requiredLevel3');
    setWordLanginnerHTML('previous-button','goBack');
    setWordLanginnerHTML('later-button','completeThen');
    setWordLanginnerHTML('next-button','continue');
    setWordLanginnerHTML('ts','ts');
    setWordLanginnerHTML('completeLater','completeLater');
    setWordLanginnerHTML('completeLaterAccept','completeThen');
    setWordLanginnerHTML('completeLaterCancel','cancel');
    setWordLanginnerHTML('expired1','expired1');
    setWordLanginnerHTML('expired2','expired2');
    setWordLanginnerHTML('expSessionButton','continue');
    
    /*Placeholder*/
    setWordLangPlaceHolder('numberIdAlt','numberId');
    setWordLangPlaceHolder('socialReason','businessName');
    setWordLangPlaceHolder('comercialNameAlt','comercialName');
    setWordLangPlaceHolder('postalCode','postalCode');
    setWordLangPlaceHolder('phone','exmpleNumber');
    setWordLangPlaceHolder('web','websiteEx');
    
    /* Select */
    setWordLanginnerHTML('selectVenezuelan','select');
    setWordLanginnerHTML('selectVenezuelanYes','yes');
    setWordLanginnerHTML('selectVenezuelanNo','no');
    setWordLanginnerHTML('selectType','select');
    setWordLanginnerHTML('selectType1','selectType1');
    setWordLanginnerHTML('selectType2','selectType2');
    setWordLanginnerHTML('selectType3','selectType3');
    
    getEntry(getParameterByName('sessionid'));

}





