﻿function Calculate(txtAmount, txtPrice, price) {
    
    var amount = document.getElementById(txtAmount).value;

    if (parseInt(amount) >= 0 && !isNaN(amount)) {
            
            var result = parseInt(amount) * parseFloat(price);

            document.getElementById(txtPrice).value = parseFloat(result).toFixed(2).replace('.', ',');
            return true;
    }
    else  {
        document.getElementById(txtPrice).value = "";
        return false;
    }
}
function SetAmount(txtAmount, link) {


    var amount = document.getElementById(txtAmount).value;

    if (parseFloat(amount) >= 0 && !isNaN(amount)) {
        var xmlhttp;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        }
        else if (window.ActiveXObject) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {

            }
        }
        xmlhttp.open("GET", link + "/getamount.ashx?amount=" + amount, true);
        xmlhttp.send(null);
    }
    else {
        window.location = link + "/index.aspx";

    }
}

