  var Venta4Net_Price = new Array(3300,7900,12200,18500,28100,42300);
  var Venta4Net_Plus_Price = new Array(5000,11900,18300,27800,42200,63500);
  var Client_Price = 600;
  var Dongle_Price = 700;
  var Min_Client = 4;

  function SetImageVisible() {

    if (document.calculator.dongle.checked) {
      document.getElementById('box').style.visibility = 'visible';
    } else {
      document.getElementById('box').style.visibility = 'hidden';
    };
  }

  function SetMin() {

    var box_image = document.getElementById('box');
 
    if (document.calculator.server_plus[0].checked) {
      document.getElementById('min_client').innerHTML = 'ìèí. 4';
      if (box_image) box_image.src = 'images-v4net/v4n_box_middle.jpg';
      Min_Client = 4;
    } else {
      document.getElementById('min_client').innerHTML = 'ìèí. 10';
      if (box_image) box_image.src = 'images-v4net/v4n_plus_box_middle.jpg';
      Min_Client = 10;
    };

    if (box_image) SetImageVisible();

    if (document.calculator.num_clients.value < Min_Client) document.calculator.num_clients.value = Min_Client;

    Calc();
  };

  // Ñ÷èòàåì
  function Calc() {

    var link_to_buy = 'order_';
    var Server_Price = 0;

    if ((document.calculator.num_clients.value < Min_Client) || (document.calculator.num_clients.value > 255)) {
      document.calculator.result.value = 'NaN'
      document.getElementById('buy').href = '';
    } else {
      if (document.calculator.server_plus[0].checked) {
        Server_Price = Venta4Net_Price[document.calculator.num_lines.value];
      } else {
        Server_Price = Venta4Net_Plus_Price[document.calculator.num_lines.value];
        link_to_buy = link_to_buy + 'plus_';
      }
      document.calculator.result.value = Server_Price + parseInt(document.calculator.num_clients.value) * Client_Price;
      if (document.calculator.dongle.checked) {
        document.calculator.result.value = parseInt(document.calculator.result.value) + Dongle_Price;
        link_to_buy = link_to_buy + 'box.php';
      } else {
        link_to_buy = link_to_buy + 'online.html';
      };
      document.getElementById('buy').href = link_to_buy+'?num_lines='+document.calculator.num_lines.value+'&num_clients='+document.calculator.num_clients.value;
    }

  };
