function mmInitialize(parent, lstGroup, lstCategory, lstItems, make, model, make_caption, model_caption, bnew)
{
    mmInitializeEx(parent, lstGroup, lstCategory, lstItems, make, model, make_caption, model_caption, bnew, false);
}


function mmInitializeEx(parent, lstGroup, lstCategory, lstItems, make, model, make_caption, model_caption, bnew, buse_short_name)

{

    clearList(lstGroup);
    if (bnew == 'true')
	{
        for (var i = 0; i < mmGroup.length; i++)
        {
            if (mmGroup[i])
			{

				if (mmGroup[i].indexOf('#') != -1)
				{
					var rgModel = mmGroup[i].split('#');
					sName = rgModel[1];
					sValue = rgModel[0];
				}
				else
					sName = sValue = rgModels[i];

                addElement(lstGroup, sName, sValue);
            }
        }
    }

    if (make)
    {
        setDefaultByText(parent.mmCategory, make);
        
        if (model_caption != "none")
            mmChangeMakeEx(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, buse_short_name);
        
        if (model)
            setDefaultByText(parent.mmItem, model);
	}
    else
	{
        lstCategory.selectedIndex = 0;
        mmChangeMakeEx(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, buse_short_name);
    }
}


function mmChangeMake(parent, lstGroup, lstCategory, lstItems, bnew, model_caption)
{
    mmChangeMakeEx(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, false);
}

function InitializeModel(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, makeID)
{
	//ModelsPopulate(parent, mmItem[makeID], model_caption, false);
}

function mmChangeMakeEx(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, buse_short_name)
{
	var ModelList = mmItems[lstCategory.options[lstCategory.selectedIndex].value];
	ModelsPopulate(parent, lstGroup, lstCategory, lstItems, ModelList, model_caption, buse_short_name);
} 

function mmChangeCategoryEx(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, buse_short_name)
{
	var CategoryList = mmCategory[lstGroup.options[lstGroup.selectedIndex].value];
	CategoryPopulate(parent, lstGroup, lstCategory, lstItems, CategoryList, model_caption, buse_short_name);
	mmChangeMakeEx(parent, lstGroup, lstCategory, lstItems, bnew, model_caption, buse_short_name);
} 

function ModelsPopulate(parent, lstGroup, lstCategory, lstItems, ModelList, model_caption, buse_short_name)
{
	clearList(lstItems);
  if(ModelList)
  {
      var rgModels = ModelList.split(',');
      for (var i = 0; i < rgModels.length; i++)
      {
          var sName, sValue;
			if (rgModels[i].indexOf('#') != -1)
			{
				var rgModel = rgModels[i].split('#');
				sName = rgModel[1];
				sValue = rgModel[0];
			}
			else
				sName = sValue = rgModels[i];
          if (rgModels[i])
          {
              addElement(lstItems, sName, sValue);
          }
      }
      lstItems.disabled = false;
  }
  else
      lstItems.disabled = true;

  lstItems.selectedIndex = 0;
}

function CategoryPopulate(parent, lstGroup, lstCategory, lstItems, CategoryList, model_caption, buse_short_name)
{
	clearList(lstCategory);
  if(CategoryList)
  {
      var rgCategory = CategoryList.split(',');
      for (var i = 0; i < rgCategory.length; i++)
      {
          var sName, sValue;
			if (rgCategory[i].indexOf('#') != -1)
			{
				var rgModel = rgCategory[i].split('#');
				sName = rgModel[1];
				sValue = rgModel[0];
			}
			else
				sName = sValue = rgCategory[i];
          if (rgCategory[i])
          {
              addElement(lstCategory, sName, sValue);
          }
      }
      lstCategory.disabled = false;
  }
  else
      lstCategory.disabled = true;

  lstCategory.selectedIndex = 0;
}

function ModelChange(e, url)
{
	var o = e.target || window.event.srcElement;
	var model = o.options[o.selectedIndex].value;
	document.location = url + escape(model);
}
