$(document).ready(function()
{
    $('#depositor').change(function()
    {
        $.get(createLink('trade', 'ajaxGetCurrency', 'depositorID=' + $(this).val()), function(currency)
        {
            if(!currency) return false;

            var exchangeRate = currency == v.mainCurrency ? 1 : '';
            $('#currency').val(currency);
            $('#currencyLabel').val(currency);
            $('.exchangeRate').val(exchangeRate).toggle(currency != v.mainCurrency);
        });
    });

    $('.exchangeRate').hide();

    if(v.type == 'repay')
    {
        $('tr.loanList').show();
        $('tr.interest').show();
        $('tr.trader').hide();
    }
    else
    {
        $('tr.loanList').hide();
        $('tr.interest').hide();
        $('tr.trader').show();
    }
});
