function changePayForm(currenctSystem)
{
    $('.payForm').hide();
    $('#'+currenctSystem+'Form').show();
    $('.paySystemImg').hide();
    $('#'+currenctSystem).show();
}

function loadForProfessionals()
{
    $.post(
        '/for-professionals.php?noLayout=1',
        function(result) {
            $('#right_column').html(result);
        }
    );
}

function loadIndex()
{
    $.post(
        '/index.php?noLayout=1',
        function(result) {
            $('#right_column').html(result);
        }
    );
}

function gotoSignup(value)
{
    location.href = '/signup.php?access=' + value;
}

function completeCalculator()
{
    $('#Bet').val(1000);
    SetOrigBet();
    $('#type').val('1-X-2');
    $('#kp1').val('1.6');
    $('#kp2').val('8.8');
    $('#kp3').val('4.3');
    $('#button').click();
}

function completeSuperCalculator(type)
{
    var tsource = Array('1-2X','H1(-0.5)-2X','1X-2','1X-H2(-0.5)','1-H2(+0.5)',
        'H1(+0.5)-2','X-12','12-X','W1-W2','H1(0)-H2(0)',
        'H1(0)-W2','W1-H2(0)','H1(-0.5)-X-2','1-X-H2(-0.5)',
        'W1-ST(2:0)-ST(2:1)','W1-ST(0:2)-ST(1:2)','ST(2:1)-ST(2:0)-W2','ST(1:2)-ST(0:2)-W2', 'H1(-0.5)-E2(+1)');
    var tdest = Array('1-2','1-2','1-2','1-2','1-2',
        '1-2','1-2','1-2','1-2','1-2',
        '1-2','1-2','1-X-2','1-X-2',
        '1-X-2','1-X-2','1-X-2','1-X-2', '1-2');

    $('#Bet').val(100);
    SetOrigBet();

    var l = type.indexOf(' (1HF)');
    if (l>=0) { type = type.substring(0,l); }
    var l = type.indexOf(' (2HF)');
    if (l>=0) { type = type.substring(0,l); }

    for (i=0; i<19; i++)
    {
       if (type == tsource[i]) { type = tdest[i]; break; }
    }
    $('#type').val(type);
    $('#button').click();
}

function php_urlencode (str) {
    str = escape(str);
    return str.replace(/[*+\/@]|%20/g,
    function (s) {
        switch (s) {
            case "*": s = "%2A"; break;
            case "+": s = "%2B"; break;
            case "/": s = "%2F"; break;
            case "@": s = "%40"; break;
            case "%20": s = "+"; break;
        }
        return s;
        }
    );
}