function hideButton(me, status) {
    me.style.display = 'none';
    document.getElementById(status + 'Status').style.display = 'block';
}

function showButton(me, status) {
    me.style.display = 'block';
    document.getElementById(status + 'Status').style.display = 'none';
}

function openGame(pageCode, width, height) {
    var domain = 'https://www.scandicbookmakers.com/CasinoLive/';
    if(width && height){
        window.open(domain + 'game/' + pageCode, '_blank',
            'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no' +
            ', width=' + width + ', height=' + height);
    } else {
        window.open(domain + 'game/' + pageCode, '_blank',
            'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no');
    }
}

function updateCasinoBalance() {
    document.getElementById('transForm:updateBalance').click();
}

function validBuyInput() {
    showError('');
    var amount = document.getElementById('transForm:buyAmountInput').value;
    amount = amount.replace(',','.');
    var reg = /^\d+(\.\d*)?$/;
    var eql = amount.match(reg);

    if (eql == null) {
        showError(getBundle()[0]);
        return false;
    } else {
        return true;
    }
}

function validCashInInput() {
    showError('');
    var amount = document.getElementById('transForm:cashInAmountInput').value;
    amount = amount.replace(',','.');
    var reg = /^\d+(\.\d*)?$/;
    var eql = amount.match(reg);

    if (eql == null) {
        showError(getBundle()[0]);
        return false;
    } else {
        return true;
    }
}

function showError(message) {
    document.getElementById('transForm:errorText').innerHTML = message;
}

function getBundle() {
    var lang = document.getElementById('languageForm:language').value;
    if(lang == 'PL') {
        return getPolish();
    } else if(lang == 'DA') {
        return getDanish();
    } else {
        return getEnglish();
    }
}

function getDanish() {
    return new String("Incorrect value.").split(',');
}

function getEnglish() {
    return new String("Incorrect value.").split(',');
}

function getPolish() {
    return new String("Niepoprawna warto\u015b\u0107.").split(',');
}