var brandLoaded=false;
function xName(e){
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}
function fillBrands(obj,selected , callBack){
	obj = xName(obj);
	obj.options.length=1;
	if (!brands) return
	var hm=0;
	for (var i=0;i<brands.length;i++){
		if (hm!=brands[i][2]){
			if (brands[i][2]==1)
				obj.options.add(new Option("--国产--",""))	;
			else
				obj.options.add(new Option("--进口--",""));	
		}
		obj.options.add(new Option("　"+brands[i][1],brands[i][0]));
		hm=brands[i][2];
	}
	if (selected!=null&&selected!=""){
		obj.value=selected
 		obj.onchange();
	}
	brandLoaded=true;
	if (callBack && typeof(callBack) == "function") callBack();
}
function fillSeries(bid,target,selected,showModel)
{
	var objName = target;
	target = xName(target);
	window.seriesOnload = function()
	{
		target.options[0].text = "-系列/车型-";
	}
	target.options[0].text = "(Loading...)";
	target.options.length = 1;
	
	var e = document.createElement('script');
	e.src = "/car/_series.asp?selected="+ selected +"&Models="+ showModel +"&obj="+ objName + "&bid=" + bid;
	
	document.body.insertBefore(e,document.body.firstChild);	
}