﻿$(function()
{
    var countryCallback = function()
    {
        var country = $("select#country").val();

        $("select#price option").remove();
        switch (country)
        {
            case 'lt':
                $("select#price").append(jQuery('<option></option').val(1).html("1 LT"));
                $("select#price").append(jQuery('<option></option').val(2).html("2 LT"));
                $("select#price").append(jQuery('<option></option').val(3).html("3 LT"));
                $("select#price").append(jQuery('<option></option').val(5).html("5 LT"));
                $("select#price").append(jQuery('<option></option').val(10).html("10 LT"));
                break;
            case 'en':
                $("select#price").append(jQuery('<option></option').val(5).html("1.5 GBP"));
                break;
            case 'ie':
                $("select#price").append(jQuery('<option></option').val(6).html("2 EUR"));
                break;
        }

        callback();
    }

    var callback = function()
    {
        var country = $("select#country").val();
        var price = $("select#price").val();
        var name = $("input#name").val();

        var keyword = "";
        var number = "";
        switch (country)
        {
            case 'lt':
                keyword = "FOR";
                number = "1337";
                break;
            case 'en':
                keyword = "FOR";
                number = "88999";
                break;
            case 'ie':
                keyword = "PTW";
                number = "57802";
                break;
        }

        $("p#msg").text(keyword+' DKTM'+price+' L2 '+name);

        var rewardAmmount = '1';
        var rewardText = 'Apiga monetą';
        switch (price)
        {
            case '1':
                rewardAmmount = '1 ';
                rewardText = 'Apiga monetą';
                break;
            case '2':
                rewardAmmount = '2';
                rewardText = 'Apiga monetas';
                break;
            case '3':
                rewardAmmount = '3';
                rewardText = 'Apiga monetas';
                break;
            case '5':
                rewardAmmount = '5';
                rewardText = 'Apiga monetas';
                break;
            case '6':
                rewardAmmount = '6';
                rewardText = 'Apiga monetas';
                break;
            case '10':
                rewardAmmount = '10';
                rewardText = 'Apiga monetų';
                break;
        }

        $("span#number").text(number);
        $("span#rewardAmmount").text(rewardAmmount);
        $("span#rewardText").text(rewardText);
    }

    $("select#country").change(countryCallback);
	$("select#price").change(callback);
    $("input#name").keyup(callback);

    callback();
});