
function changeMenuClass(i, activeFlag)
{
  cellObj = document.getElementById('menu_cell_' + i);

  if(activeFlag)
    class_name = 'menu_active_cell';
  else
    class_name = 'menu_cell';

  cellObj.className = class_name;
}

function menu_over(i)
{
  changeMenuClass(i, 1);
}

function menu_out(i)
{
  changeMenuClass(i, 0);
}

function basketBtnOver(obj)
{
  obj.src = './images/basketbtn_hover.gif';
}

function basketBtnOut(obj)
{
  obj.src = './images/basketbtn.gif';
}

function openTovarDetailWindow(id)
{
  tovarInfoWindow = window.open("./tovardetail.php?id=" + id,"_blank","width=800, resizable=yes, menubar=no, location=no, toolbar=no, scrollbars=yes");
}

function openProducerDetailWindow(id) {
  prodInfoWindow = window.open("./producer_detail.php?id=" + id,"_blank","width=800, resizable=yes, menubar=no, location=no, toolbar=no, scrollbars=yes");
}


function tovardetailAllTovarsClick()
{
  if(window.opener)
  {
    window.opener.location.replace("http://www.avtokvadro.ru/webmag.php");
    window.close();
  }
  else
    window.location.replace("http://www.avtokvadro.ru/webmag.php");
}

function tovardetailImageClick(clickedImage_i, fName)
{
  for(i = 0; imgObj = document.getElementById('tovardetai_image' + i); i++)
    imgObj.className = 'tovardetail_image';

  clcdImgObj = document.getElementById('tovardetai_image' + clickedImage_i);
  clcdImgObj.className = 'tovardetail_active_image';

  bigImgObj = document.getElementById('tovardetail_bigimage');
  bigImgObj.src = fName;
}

function tovar_add2basket_field_change(i) {
  obj = document.getElementById("abf_" + i);
  text = obj.value;
  newText = '';
  roolNums = 0;
  for(i = 0; text.charAt(i); i++) {
    word = text.charAt(i);
if(!isNaN(parseInt(word)))
{
newText += text.charAt(i);
roolNums ++;
}
}

if(roolNums > 0)
obj.style.backgroundColor = "FCF76F";
else
obj.style.backgroundColor = "ffffff";

obj.value = newText;
}
