﻿/// <reference name="MicrosoftAjax.js"/>

//можно нажать только 1234567890, ",", Backspace и Enter
function noNumbers(e, id) {
    //  alert('123');
    var gameID = document.getElementById('ctl00_cph_content_middle_GameID');
    var WordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    var keynum;
    var keychar;
    var numcheck;
    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
  /*  else {
        numcheck = "1234567890";
        var i = 0;
        var n = 0;
        while (numcheck[i] != undefined) {
            if (e == numcheck[i]) n = 1;
            i++;
        }
        if (n == 1) return true;
        else return false;
    }*/
    keychar = String.fromCharCode(keynum);
    if ((id == 'ctl00_cph_content_middle_Cash') || (gameID.value != "0") || (WordLegth.value == "1") || (WordLegth.value == "2")) numcheck = /[0123456789,\b\r]/;
    else numcheck = /[0123456789\b\r]/;
   // alert(e + " " + keynum + " " + numcheck + " " + numcheck.test(keychar));
    return numcheck.test(keychar);
}

//Вставляет пробел после 3х символов в формате 12 345,6789
function len(val) {
    var freeText = val.replace(/\s+/g, "");
    var Mass = new Array();
    Mass = freeText.split(',');
    var str = lenhelper(Mass[0]);
    if (Mass[1] != undefined) str = str + ', ' + lenhelper(Mass[1]);
    return str;
}
//Вспомогалка len
function lenhelper(val) {
    var len = val.length;
    var str = "";

    for (i = 0; i <= len; i++) {
        if ((i - 1) % 3 == 0) str = val.charAt(len - i) + " " + str;
        else str = val.charAt(len - i) + str;
    }
    str = str.replace(/^\s+/, '').replace(/\s+$/, '');
    return str
}
//применяет len к определенному полю
function GameCurrencyLen(obj, val) {
    var target = document.getElementById(obj);
    var WordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    if ((obj == "ctl00_cph_content_middle_Finish") || (obj == "ctl00_cph_content_middle_Start")) {
        var Mass = new Array();
        temp = len(val);
        Mass = temp.split(',');
        if ((temp[1] == ',') || (temp[2] == ',')) {
            target.value = Mass[0] + "," + Mass[1].substr(0, 3);
        }
        else target.value = Mass[0].substr(0, 2);
    }
    else target.value = len(val);
}
function cashlen(obj, val) {
    var cashHelper = document.getElementById("ctl00_cph_content_middle_CashHelper");
    var money = document.getElementById("ctl00_cph_content_middle_Currency");
    var moneyHelper = document.getElementById("ctl00_cph_content_middle_CurrencyHelper");
    var target = document.getElementById(obj);
    cashHelper.value = val;
    temp = len(val);
    Mass = temp.split(',');
    if ((money.value == "3") || (money.value == "6") || (Mass[1] == undefined)) target.value = Mass[0];
    else if (Mass[1] != undefined) {
        var n = 3;
        if (money.value == "5") n = 6;
        target.value = Mass[0] + "," + Mass[1].substr(0, n);
    }
//    target.value = len(val);
    moneyHelper.value = money.value;
}

//ф-ция для добавления элемента в листбокс. Нужен для op(index)
function addOption(oListbox, text, value, isDefaultSelected, isSelected) {
    var oOption = document.createElement("option");
    oOption.appendChild(document.createTextNode(text));
    oOption.setAttribute("value", value);

    if (isDefaultSelected) oOption.defaultSelected = true;
    else if (isSelected) oOption.selected = true;

    oListbox.appendChild(oOption);
}

//ф-ция динамического изменения CalcMoney в зависимости от MSystem
function op(index) {
    var l = document.getElementById("ctl00_cph_content_middle_Currency");
    l.options.length = 0;
    if (index == 0) {
          addOption(l, "WMR", 0, true);
          addOption(l, "WMU", 1);
          addOption(l, "WME", 2);
          addOption(l, "WMY", 3);
          addOption(l, "WMZ", 4);
          addOption(l, "WMG", 5);
          addOption(l, "WMB", 6);
          contactCorrection(0);
    }
    if (index == 1) {
        addOption(l, "рубли", 7, true);
        contactCorrection(0);
    }
    if (index == 2) {
        addOption(l, "рубли", 8, true);
        contactCorrection(1);
    }
}
//Функция корректирования поля контактов (QIWI или нет)
function contactCorrection(i) {
    var Contact1Box = document.getElementById("ctl00_cph_content_middle_Contact1Box");
    var Contact0Box = document.getElementById("ctl00_cph_content_middle_Contact0Box");
    if (Contact0Box.style.display == 'block') {
        switch (i) {
            case 0:
                Contact1Box.style.display = 'none';
                break;
            case 1:
                Contact1Box.style.display = 'block';
                break;
        }
    }
}
//проверха первых 2х символов на +7.
function checkPlus7(val) {
    var text = document.getElementById('ctl00_cph_content_middle_Contact1');
    text.value = "+7" + val.substr(2);
}
//вкл/выкл красный бг
function bgalarm(obj, i){
    switch(i){
        case 0:default:
            obj.style.backgroundColor = '#EAF2F4';
            break;
        case 1:
            obj.style.backgroundColor = 'red';
            break;
    }
}
//вкл/выкл поле
function disobj(i,j) {
    var cash = document.getElementById("ctl00_cph_content_middle_Cash");
    var gameCurrency = document.getElementById("ctl00_cph_content_middle_GameCurrency");
    var nick = document.getElementById("ctl00_cph_content_middle_Nick");
    var contact0 = document.getElementById("ctl00_cph_content_middle_Contact0");
    var contact1 = document.getElementById("ctl00_cph_content_middle_Contact1");
    var note = document.getElementById('ctl00_cph_content_middle_note');
    var paymentSystem = document.getElementById('ctl00_cph_content_middle_PaymentSystem');
    var game = document.getElementById('ctl00_cph_content_middle_Game');
    var operation = document.getElementById('ctl00_cph_content_middle_Operation');
    var gServer = document.getElementById('ctl00_cph_content_middle_gServer');
    var Side = document.getElementById('ctl00_cph_content_middle_Side');
    var WordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    var Currency = document.getElementById('ctl00_cph_content_middle_Currency');
    var gameID = document.getElementById('ctl00_cph_content_middle_GameID');
    var rule = document.getElementById('RuleBox');
    var button = document.getElementById('ctl00_cph_content_middle_CashSubmit');
    var pay = document.getElementById('Pay');
    var pays = document.getElementById('PayS');
    var infobox = document.getElementById('infob');
    var Start = document.getElementById('ctl00_cph_content_middle_Start');
    var Finish = document.getElementById('ctl00_cph_content_middle_Finish');
    var Speed = document.getElementById('ctl00_cph_content_middle_Speed');
    var ruleCheck = document.getElementById('Rule');
    switch (i) {
        case 0:default:
            game.disabled = true;
            operation.disabled = true;
            Side.disabled = true;
            gServer.disabled = true;
            if (j == 0) {
                gameCurrency.disabled = true;
                WordLegth.disabled = true;
            }
            if (j == 1) {
                Start.disabled = true;
                Finish.disabled = true;
                Speed.disabled = true;
            }
            paymentSystem.disabled = true;
            cash.disabled = true;
            Currency.disabled = true;
            nick.disabled = true;
            contact0.disabled = true;
            contact1.disabled = true;
            break;
        case 1:

            if (gameID == '1') Side.disabled = false;
            gServer.disabled = false;
            if (j == 0) {
                gameCurrency.disabled = false;
                WordLegth.disabled = false;
            }
            if (j == 1) {
                Start.disabled = false;
                Finish.disabled = false;
                Speed.disabled = false;
            }
            paymentSystem.disabled = false;
            cash.disabled = false;
            Currency.disabled = false;
            nick.disabled = false;
            contact0.disabled = false;
            contact1.disabled = false;
            rule.style.display = 'none';
            note.innerHTML = "";
            button.style.display = 'block';
            button.value = "Далее";
            var n = 1;
            if (contact0.style.display == 'none') n = 0;
            button.onclick = function() { CheckMinValues(n, j); };
            pay.style.display = 'none';
            pays.style.display = 'none';
            infobox.style.display = 'none';
            ruleCheck.checked = false;
            break;
    }
}
//проверка заполняемости полей
function CheckMinValues(i, j) {
    var cash = document.getElementById("ctl00_cph_content_middle_Cash");
    var cashBox = document.getElementById("ctl00_cph_content_middle_CashBox");
    var gameCurrency = document.getElementById("ctl00_cph_content_middle_GameCurrency");
    var gameCurrencyBox = document.getElementById("ctl00_cph_content_middle_GameCurrencyBox");
    var nick = document.getElementById("ctl00_cph_content_middle_Nick");
    var nickBox = document.getElementById("ctl00_cph_content_middle_NickBox");
    var contact0 = document.getElementById("ctl00_cph_content_middle_Contact0");
    var contact0Box = document.getElementById("ctl00_cph_content_middle_Contact0Box");
    var contact1 = document.getElementById("ctl00_cph_content_middle_Contact1");
    var contact1Box = document.getElementById("ctl00_cph_content_middle_Contact1Box");
    var button = document.getElementById('ctl00_cph_content_middle_CashSubmit');
    var note = document.getElementById('ctl00_cph_content_middle_note');
    var noteBox = document.getElementById('errorMessage');
    var paymentSystem = document.getElementById('ctl00_cph_content_middle_PaymentSystem');
    var game = document.getElementById('ctl00_cph_content_middle_Game');
    var operation = document.getElementById('ctl00_cph_content_middle_Operation');
    var gServer = document.getElementById('ctl00_cph_content_middle_gServer');
    var Side = document.getElementById('ctl00_cph_content_middle_Side');
    var WordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    var Currency = document.getElementById('ctl00_cph_content_middle_Currency');
    var rule = document.getElementById('RuleBox');
    var ruleCheck = document.getElementById('Rule');
    var Start = document.getElementById('ctl00_cph_content_middle_Start');
    var StartBox = document.getElementById('ctl00_cph_content_middle_StartBox');
    var Finish = document.getElementById('ctl00_cph_content_middle_Finish');
    var FinishBox = document.getElementById('ctl00_cph_content_middle_FinishBox');
    switch(i){
        case 0:default:
            if (j == 0) {
                textToggle();
            }
            if (j == 1) {
                persToggle();
            }
            break;
        case 1:
            var n = 0;
            if (cash.value.length < 1) {
                bgalarm(cashBox, 1);
                n++;
            }
            else bgalarm(cashBox, 0);
            if (j == 0) {
                if (gameCurrency.value.length < 1) {
                    bgalarm(gameCurrencyBox, 1);
                    n++;
                }
                else bgalarm(gameCurrencyBox, 0);
            }
            if (j == 1) {
                if (Start.value.length < 1) {
                    bgalarm(StartBox, 1);
                    n++;
                }
                else bgalarm(StartBox, 0);
                if (Finish.value.length < 1) {
                    bgalarm(FinishBox, 1);
                    n++;
                }
                else bgalarm(FinishBox, 0);
            }
            if (nick.value.length < 1) {
                bgalarm(nickBox, 1);
                n++;
            }
            else bgalarm(nickBox, 0);
            if (contact0.value.length < 1) {
                bgalarm(contact0Box, 1);
                n++;
            }
            else bgalarm(contact0Box, 0);
            if ((contact1.value.length != 12) && (paymentSystem.options[paymentSystem.selectedIndex].value == 2)) {
                bgalarm(contact1Box, 1);
                n++;
            }
            else bgalarm(contact1Box, 0);
            if (note.innerHTML.length > 0) {
                n++;
            }
            //    alert(i + " " + note.innerHTML.length);
            if (n == 0) {
                disobj(0, j);
                rule.style.display = 'block';
                button.value = "Отмена";
                button.onclick = function() { disobj(1, j); };
                var pay = document.getElementById('Pay');
                var pays = document.getElementById('PayS');
                pays.style.display = 'inline';
                pays.onclick = function() { CheckMinValues(2, j); };
                switch (paymentSystem.options[paymentSystem.selectedIndex].value - 0) {
                    case 0: default:
                        pay.onclick = function() { toWm(); };
                        break;
                    case 1:
                        pay.onclick = function() { toYA(); };
                        break;
                    case 2:
                        pay.onclick = function() { toQ(); };
                        break;
                }
            }
            break;
        case 2:
            if (ruleCheck.checked == true) {
                note.innerHTML = " ";
            }
            else {
                note.innerHTML = "Вы обязаны согласиться с условиями сервиса.";
                //   alert(paymentSystem.options[paymentSystem.selectedIndex].value);
            }
            break;
    }
}
function PayChange() {
    var ruleCheck = document.getElementById('Rule');
    var pay = document.getElementById('Pay');
    var pays = document.getElementById('PayS');
    var button = document.getElementById('ctl00_cph_content_middle_CashSubmit');
    var paymentSystem = document.getElementById('ctl00_cph_content_middle_PaymentSystem');
    if ((ruleCheck.checked == true) && (paymentSystem.options[paymentSystem.selectedIndex].value != "1")){
        pay.style.display = 'inline';
        pays.style.display = 'none';
        button.style.display = 'inline';
        pays.onclick = function() { CheckMinValues(2, 0); };
    }
    else if ((ruleCheck.checked == true) && (paymentSystem.options[paymentSystem.selectedIndex].value == "1")) {
        pay.style.display = 'none';
        pays.style.display = 'inline';
        button.style.display = 'inline';
        pays.onclick = function() { toYA(); };
    }
    else {
        pays.style.display = 'inline';
        pay.style.display = 'none';
        button.style.display = 'inline';
        pays.onclick = function() { CheckMinValues(2, 0); };
    }
}
//Вкл/выкл оплаты
function textToggle() {
    var cashBox = document.getElementById("ctl00_cph_content_middle_CashBox");
    var gameCurrencyBox = document.getElementById("ctl00_cph_content_middle_GameCurrencyBox");
    var noteBox = document.getElementById('errorMessage');
    Contact0Box = document.getElementById('ctl00_cph_content_middle_Contact0Box');
    Contact1Box = document.getElementById('ctl00_cph_content_middle_Contact1Box');
    NickBox = document.getElementById('ctl00_cph_content_middle_NickBox');
    PaymentSystem = document.getElementById('ctl00_cph_content_middle_PaymentSystem');
    gameID = document.getElementById('ctl00_cph_content_middle_GameID');
    header = document.getElementById('ctl00_cph_content_top_fouth');
    bThrid = document.getElementById('ctl00_cph_content_bottom_bThrid');
    bFouth = document.getElementById('ctl00_cph_content_bottom_bFouth');
    var button = document.getElementById('ctl00_cph_content_middle_CashSubmit');

    //links
    var links;
    if (gameID.value == '0') links = "lineage.aspx?inf=3";
    else if (gameID.value == '1') links = "wow.aspx?inf=5";
    else if (gameID.value == '2') links = "eve.aspx?inf=3";
    else if (gameID.value == '3') links = "aion.aspx?inf=3";

    //Калькулятор
    if (Contact0Box.style.display == 'block') {
        Contact0Box.style.display = 'none';
        NickBox.style.display = 'none';
        Contact1Box.style.display = 'none';
        bgalarm(cashBox, 0);
        bgalarm(gameCurrencyBox, 0);
        bgalarm(NickBox, 0);
        bgalarm(Contact0Box, 0);
        bgalarm(Contact1Box, 0);
        disobj(1, 0);
        header.innerHTML = "Калькулятор";
        bThrid.innerHTML = "Вопросы и ответы";
        bThrid.href = "#";
        bFouth.onclick = function() { textToggle(); };
        button.onclick = function() { CheckMinValues(0,0); };
        bFouth.innerHTML = "Оплатить";
        bThrid.onclick = function() { location.replace(links); };
    }
    //Оплата
    else {
        Contact0Box.style.display = 'block';
        NickBox.style.display = 'block';
        if (PaymentSystem.value == 2) contactCorrection(1);
        else contactCorrection(0);
        header.innerHTML = "Оплатить";
        bThrid.innerHTML = "Калькулятор";
        bThrid.href = "#";

        bThrid.onclick = function() { textToggle(); };
        button.onclick = function() { CheckMinValues(1,0); };
        bFouth.onclick = function() { location.replace(links); };
        bFouth.innerHTML = "Вопросы и ответы";
    }
}
//Вкл/Выкл оплаты для прокачки
function persToggle() {
    var cashBox = document.getElementById("ctl00_cph_content_middle_CashBox");
    var noteBox = document.getElementById('errorMessage');
    Contact0Box = document.getElementById('ctl00_cph_content_middle_Contact0Box');
    Contact1Box = document.getElementById('ctl00_cph_content_middle_Contact1Box');
    NickBox = document.getElementById('ctl00_cph_content_middle_NickBox');
    PaymentSystem = document.getElementById('ctl00_cph_content_middle_PaymentSystem');
    gameID = document.getElementById('ctl00_cph_content_middle_GameID');
    header = document.getElementById('ctl00_cph_content_top_fouth');
    bThrid = document.getElementById('ctl00_cph_content_bottom_bSecond');
    bFouth = document.getElementById('ctl00_cph_content_bottom_bThrid');
    var button = document.getElementById('ctl00_cph_content_middle_CashSubmit');
    var StartBox = document.getElementById('ctl00_cph_content_middle_StartBox');
    var FinishBox = document.getElementById('ctl00_cph_content_middle_FinishBox');

    //links
    var links;
    if (gameID.value == '0') links = "lineage.aspx?inf=6";
    else if (gameID.value == '1') links = "wow.aspx?inf=6";
    else if (gameID.value == '2') links = "eve.aspx?inf=6";
    else if (gameID.value == '3') links = "aion.aspx?inf=6";

    if (Contact0Box.style.display == 'block') {
        Contact0Box.style.display = 'none';
        NickBox.style.display = 'none';
        Contact1Box.style.display = 'none';
        bgalarm(cashBox, 0);
        bgalarm(StartBox, 0);
        bgalarm(FinishBox, 0);
        bgalarm(NickBox, 0);
        bgalarm(Contact0Box, 0);
        bgalarm(Contact1Box, 0);
        disobj(1, 1);
        header.innerHTML = "Калькулятор";
        bThrid.innerHTML = "Вопросы и ответы";
        bThrid.href = "#";
        bFouth.onclick = function() { persToggle(); };
        button.onclick = function() { CheckMinValues(0,1); };
        bFouth.innerHTML = "Оплатить";
        bThrid.onclick = function() { location.replace(links); };
    }
    //Оплата
    else {
        Contact0Box.style.display = 'block';
        NickBox.style.display = 'block';
        if (PaymentSystem.value == 2) contactCorrection(1);
        else contactCorrection(0);
        header.innerHTML = "Оплатить";
        bThrid.innerHTML = "Калькулятор";
        bThrid.href = "#";

        bThrid.onclick = function() { persToggle(); };
        button.onclick = function() { CheckMinValues(1,1); };
        bFouth.onclick = function() { location.replace(links); };
        bFouth.innerHTML = "Вопросы и ответы";
    }
}
function toWm() {

    cash = document.getElementById('ctl00_cph_content_middle_Cash');
    amount = document.getElementById('LMI_PAYMENT_AMOUNT');
    amount.value = cash.value.replace(/\s+/g, "").replace(',', '.');

    game = document.getElementById('ctl00_cph_content_middle_Game');
    gserver = document.getElementById('ctl00_cph_content_middle_gServer');
    Side = document.getElementById('ctl00_cph_content_middle_Side');
    gameCurrency = document.getElementById('ctl00_cph_content_middle_GameCurrency');
    wordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    currency = document.getElementById('ctl00_cph_content_middle_Currency');
    nick = document.getElementById('ctl00_cph_content_middle_Nick');
    contact0 = document.getElementById('ctl00_cph_content_middle_Contact0');
    desc = document.getElementById('LMI_PAYMENT_DESC');
    Start = document.getElementById('ctl00_cph_content_middle_Start');
    Finish = document.getElementById('ctl00_cph_content_middle_Finish');
    Speed = document.getElementById('ctl00_cph_content_middle_Speed');
    if (gameCurrency.value != "") desc.value = "| " + game.options[game.selectedIndex].text + " | " + gserver.options[gserver.selectedIndex].text + " | " + gameCurrency.value.replace(/\s+/g, "") + " | " + cash.value.replace(/\s+/g, "") + " | " + nick.value + " | " + contact0.value + " |";
    else desc.value = "| " + game.options[game.selectedIndex].text + " | " + gserver.options[gserver.selectedIndex].text + " | " + Start.value + "-" + Finish.value + " | " + cash.value.replace(/\s+/g, "") + " | " + Speed.options[Speed.selectedIndex].text + " | " + nick.value + " | " + contact0.value + " |";


    purse = document.getElementById('LMI_PAYEE_PURSE');
    switch (currency.options[currency.selectedIndex].value - 0) {
        case 0:
            purse.value = "R316035792715";
            break;
        case 1:
            purse.value = "U218244524692";
            break;
        case 2:
            purse.value = "E208588942789";
            break;
        case 3:
            purse.value = "Y587801923712";
            break;
        case 4:
            purse.value = "Z567607104667";
            break;
        case 5:
            purse.value = "G195655500305";
            break;
        case 6:
            purse.value = "B240574606243";
            break;
    }

    document.forms[0].action = "https://merchant.webmoney.ru/lmi/payment.asp";
}
function toYA() {
    //document.forms[0].action = "check.aspx?info=yar";

    cash = document.getElementById('ctl00_cph_content_middle_Cash');
    casht = Math.round((cash.value.replace(/\s+/g, "").replace(',', '.') / 99.5) * 10000);
    casht = casht / 100;
    game = document.getElementById('ctl00_cph_content_middle_Game');
    gserver = document.getElementById('ctl00_cph_content_middle_gServer');
    gameCurrency = document.getElementById('ctl00_cph_content_middle_GameCurrency');
    wordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    currency = document.getElementById('ctl00_cph_content_middle_Currency');
    nick = document.getElementById('ctl00_cph_content_middle_Nick');
    contact0 = document.getElementById('ctl00_cph_content_middle_Contact0');
    infobox = document.getElementById('infob');
    Start = document.getElementById('ctl00_cph_content_middle_Start');
    Finish = document.getElementById('ctl00_cph_content_middle_Finish');
    Speed = document.getElementById('ctl00_cph_content_middle_Speed');
    if (gameCurrency.value != "") desc = "| " + game.options[game.selectedIndex].text + " | " + gserver.options[gserver.selectedIndex].text + " | " + gameCurrency.value.replace(/\s+/g, "") + " | " + cash.value.replace(/\s+/g, "") + " | " + nick.value + " | " + contact0.value + " |";
    else desc = "| " + game.options[game.selectedIndex].text + " | " + gserver.options[gserver.selectedIndex].text + " | " + Start.value + "-" + Finish.value + " | " + cash.value.replace(/\s+/g, "") + " | " + Speed.options[Speed.selectedIndex].text + " | " + nick.value + " | " + contact0.value + " |";
    infobox.style.display = 'block';
    infobox.innerHTML = "<br />Чтобы оплатить заказ с помощью платежной системы Яндекс.Деньги Вы должны сделать следующее:<br />1. Перевести на счет 41001329874025 сумму " + casht + " рублей, указать \"Сумму к получению\" " + cash.value.replace(/\s+/g, "") + " рублей, добавить в \"Сообщение получателю\" примечание с текстом \"" + desc + "\".<br /> 2. Сообщить менеджеру сервиса www.play-money.ru о произведенной оплате.<br /><br /><span style=\"background-color: #f90;\"><strong>ВНИМАНИЕ: Прямые платежи с терминалов на наши кошельки запрещены !</strong></span>";
}
function toQ() {
    cash = document.getElementById('ctl00_cph_content_middle_Cash');
    amount = Math.round(cash.value.replace(/\s+/g, "").replace(',', '.') * 100);
    amount = amount / 100;
    game = document.getElementById('ctl00_cph_content_middle_Game');
    gserver = document.getElementById('ctl00_cph_content_middle_gServer');
    Side = document.getElementById('ctl00_cph_content_middle_Side');
    gameCurrency = document.getElementById('ctl00_cph_content_middle_GameCurrency');
    wordLegth = document.getElementById('ctl00_cph_content_middle_WordLegth');
    currency = document.getElementById('ctl00_cph_content_middle_Currency');
    nick = document.getElementById('ctl00_cph_content_middle_Nick');
    contact0 = document.getElementById('ctl00_cph_content_middle_Contact0');
    contact1 = document.getElementById('ctl00_cph_content_middle_Contact1');
    Start = document.getElementById('ctl00_cph_content_middle_Start');
    Finish = document.getElementById('ctl00_cph_content_middle_Finish');
    Speed = document.getElementById('ctl00_cph_content_middle_Speed');
    if (gameCurrency.value != "") desc = "| " + game.options[game.selectedIndex].text + " | " + gserver.options[gserver.selectedIndex].text + " | " + gameCurrency.value.replace(/\s+/g, "") + " | " + cash.value.replace(/\s+/g, "") + " | " + nick.value + " | " + contact0.value + " |";
    else desc = "| " + game.options[game.selectedIndex].text + " | " + gserver.options[gserver.selectedIndex].text + " | " + Start.value + "-" + Finish.value + " | " + cash.value.replace(/\s+/g, "") + " | " + Speed.options[Speed.selectedIndex].text + " | " + nick.value + " | " + contact0.value + " |";
    document.forms[0].action = "http://www.mobw.ru/setInetBill.do?from=3250&to=" + contact1.value.substr(2) + "&summ=" + amount + "&com=" + escape(desc) + "&lifetime=3";
}
function CheckSF(i) {
    var start = document.getElementById('ctl00_cph_content_middle_Start');
    var finish = document.getElementById('ctl00_cph_content_middle_Finish');
    
    if ((start.value != "") && (finish.value)) {
        LvlToCash(i);
    }
}