$(document).ready(function () {
  $('.rozmer_form select').bind('change', function () {
    $('.model_form select').val('');
    carModelIdChanged(0);
  });
  $('.model_form select').bind('change', function () {
    $('.rozmer_form select').val('');
  });
});



function carModelValueIdChanged(iModelValueId)
{
  
  $('#carModelPrumerForm').load(HTTP_PATH+'ajax/ajax_car_model_prumer_form.php', {car_model_value_id: iModelValueId});
}


function carModelIdChanged(iModelId)
{
  //if (!iModelId) return true;
  
  ajaxObj = new ajax(HTTP_PATH+'ajax/ajax_car_model_form.php?car_model_id='+iModelId, 'carModelForm');
  carModelValueIdChanged(0);

}



function ajax(url, idForChange)
{
  self.idForChange = idForChange;

  if (window.XMLHttpRequest)
    self.xmlhttp=new XMLHttpRequest();
  else if (window.ActiveXObject)
    self.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  self.xmlhttp.onreadystatechange=function ()
  {
    if (self.xmlhttp.readyState == 4)
      self.changeContent();
      
  }
  self.xmlhttp.open("GET", url, true);
  self.xmlhttp.send(null);


  changeContent = function ()
  {
    elm = document.getElementById(self.idForChange);
    if (!elm) return false;
    elm.innerHTML = self.xmlhttp.responseText; 
  }
}




