function mmCarInitialize(parent, make, model, make_caption, model_caption, bnew)
{
    mmCarInitializeEx(parent, make, model, make_caption, model_caption, bnew, false);
}


function mmCarInitializeEx(parent, make, model, make_caption, model_caption, bnew, buse_short_name)
{
    clearList(parent.lstCarGroup);
    if (bnew == 'true')
	{
        for (var i = 0; i < mmCarGroup.length; i++)
        {
            if (mmCarGroup[i])
			{

				if (mmCarGroup[i].indexOf('#') != -1)
				{
					var rgModel = mmCarGroup[i].split('#');
					sName = rgModel[1];
					sValue = rgModel[0];
				}
				else
					sName = sValue = rgModels[i];

                addElement(parent.lstCarGroup, sName, sValue);
            }
        }
    }

    if (make)
    {
        setDefaultByText(parent.mmCarCategory, make);
        
        if (model_caption != "none")
            mmCarChangeMakeEx(parent, bnew, model_caption, buse_short_name);
        
        if (model)
            setDefaultByText(parent.mmCarItem, model);
	}
    else
	{
        parent.lstCarCategory.selectedIndex = 0;
        mmCarChangeMakeEx(parent, bnew, model_caption, buse_short_name);
    }
}


function mmCarChangeMake(parent, bnew, model_caption)
{
    mmCarChangeMakeEx(parent, bnew, model_caption, false);
}

function CarInitializeModel(parent, bnew, model_caption, makeID)
{
	//ModelsPopulate(parent, mmCarItem[makeID], model_caption, false);
}

function mmCarChangeMakeEx(parent, bnew, model_caption, buse_short_name)
{
	var ModelList = mmCarItems[parent.lstCarCategory.options[parent.lstCarCategory.selectedIndex].value];
	CarModelsPopulate(parent, ModelList, model_caption, buse_short_name);
} 

function mmCarChangeCategoryEx(parent, bnew, model_caption, buse_short_name)
{
	var CategoryList = mmCarCategory[parent.lstCarGroup.options[parent.lstCarGroup.selectedIndex].value];
	CarCategoryPopulate(parent, CategoryList, model_caption, buse_short_name);
	mmCarChangeMakeEx(parent, bnew, model_caption, buse_short_name)
} 

function CarModelsPopulate(parent, ModelList, model_caption, buse_short_name)
{
  clearList(parent.lstCarItems);
  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(parent.lstCarItems, sName, sValue);
          }
      }
      parent.lstCarItems.disabled = false;
  }
  else
      parent.lstCarItems.disabled = true;

  parent.lstCarItems.selectedIndex = 0;
}

function CarCategoryPopulate(parent, CategoryList, model_caption, buse_short_name)
{
  clearList(parent.lstCarCategory);
  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(parent.lstCarCategory, sName, sValue);
          }
      }
      parent.lstCarCategory.disabled = false;
  }
  else
      parent.lstCarCategory.disabled = true;

  parent.lstCarCategory.selectedIndex = 0;
}

function CarModelChange(e, url)
{
	var o = e.target || window.event.srcElement;
	var model = o.options[o.selectedIndex].value;
	document.location = url + escape(model);
}
