function window_open(url, width, height)
{
  xpos = (screen.width - width) / 2;
  ypos = (screen.height - height) / 2;

  options = "width=" + width + ",height=" + height + ",left=" + xpos + ",top=" + ypos + ",statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes";
  window.open(url, '', options);
}

function show_form()
{
  description.style.display = 'none';
  order_form.style.display = 'block';
}

function submit_coment(where)
{
  var form_span = document.getElementById('form');
  var coments = document.getElementById('coments');
  var coment_form = document.getElementById('coment_form');

  if (document.getElementById('nocoments')) document.getElementById('nocoments').innerHTML = '';

  coments.innerHTML = coments.innerHTML + '<b>' + coment_form.name.value + '</b>:<br/>' + coment_form.com.value + '<br/><br/>';

  var params = 'id=' + coment_form.id.value + '&name=' + coment_form.name.value + '&com=' + coment_form.com.value;
  
  form_span.innerHTML = '<span style="color: green">Ваше сообщение отправлено</>';

  if (window.XMLHttpRequest)
  {
    var http = new XMLHttpRequest();    
  }
  else if (window.ActiveXObject)
  {
    var http = new ActiveXObject("Microsoft.XMLHTTP");
  }

  var url = where;
  
  http.open("POST", url, true);

  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");

  http.send(params);
}

function check_tires()
{
  var tires_form = document.getElementById('tires_form');

  if (tires_form.elements[0].selectedIndex == 0 || tires_form.elements[1].selectedIndex == 0 || tires_form.elements[2].selectedIndex == 0)
  {
    alert('Задайте тироразмер шин полностью');
    return false;
  }
  
  tires_form.submit();
}

function check_disks()
{
  var disks_form = document.getElementById('disks_form');

  if (disks_form.elements[3].selectedIndex == 0 || disks_form.elements[1].selectedIndex == 0)
  {
    alert('Задайте диаметр и параметры диска');
    return false;
  }
  
  disks_form.submit();
}
