function toTheCart(theCode)
{
var quantity = document.mainForm.elements[theCode].value;
if (quantity>0) {
   var e = document.createElement('input');
e.setAttribute('type', 'hidden');
e.setAttribute('name', 'item-' + theCode);
e.setAttribute('value', quantity);
document.mainForm.appendChild(e);
document.mainForm.add_to_cart_button.value=1;
if (typeof (document.mainForm.rapid_form_button) != "undefined"){
document.mainForm.rapid_form_button.value=0;
}
document.mainForm.submit();
}
}


function changeDel(theCode)
{
var itemName = 'sb_' + theCode;
var theType = document.mainForm.elements[itemName].value;

for (var i=1; i<5; i++){
  if (theType==1){
   document.getElementById(i+'s_'+ theCode).style.display = 'none';
   document.getElementById(i+'_'+ theCode).style.display = 'block';
  }
  else if (theType==0)  {
   document.getElementById(i+'_'+ theCode).style.display = 'none';
   document.getElementById(i+'s_'+ theCode).style.display = 'block';
  }
}
}

function initSelects(){
  for (var i=0; i<document.mainForm.elements.length; i++){
    if (document.mainForm.elements[i].name.match(/^sb_/)){
      document.mainForm.elements[i].value = 1;
    }
  }
}


