bManufacturerTab = new Array();
bModelTab = new Array();

function bClearSelect(theSelect)
{
	var theSelectSize = theSelect.length;
  for (var i = 0; i < theSelectSize; i++)
  {
    theSelect.options[0] = null;
  }
}

function bManufacturerLoad(theSelect,selectedOption,defaultOption)
{
  bClearSelect(theSelect);
  theSelect.options[0] = new Option(defaultOption,"0");
  theSelect.options[0].selected = true;
  for (var i = 0; i < bManufacturerTab.length; i++)
  {
    theSelect.options[i+1] = new Option(bManufacturerTab[i],bManufacturerTab[i]);
  	if (bManufacturerTab[i] == selectedOption)
  	{
      theSelect.options[0].selected = false;
  		theSelect.options[i+1].selected = true;
  	}
  }
}

function bModelLoad(theSelect,manufacturer,selectedOption,defaultOption)
{
  bClearSelect(theSelect);
  theSelect.options[0] = new Option(defaultOption,"0");
  theSelect.options[0].selected = true;
  var j = 1;
  for (var i = 0; i < bModelTab.length; i++)
  {
    if (bModelTab[i][0] == manufacturer)
    {
      theSelect.options[j] = new Option(bModelTab[i][1],bModelTab[i][1]);
    	if (bModelTab[i][1] == selectedOption)
    	{
        theSelect.options[0].selected = false;
    		theSelect.options[j].selected = true;
    	}
      j++;
    }
  }
}

// bManufacturerAdd
function b1(manufacturer)
{
  bManufacturerTab[bManufacturerTab.length] = manufacturer;
}

// bModelAdd
function b2(manufacturer,model)
{
  bModelTab[bModelTab.length] = new Array(manufacturer,model);
}
