
function get_brands(search_brand)	{

	var dropDown;
	selectedIndex = 0;		// Default the selected option to being option[0]

	if (document.qSearch && document.qSearch.merk)  {
		dropDown = document.qSearch.merk;
	}
	else if(document.formsearch && document.formsearch.merk)  {
		dropDown=document.formsearch.merk;
	}
	else if (document.forms[0] && document.forms[0].merk)  {
		dropDown = document.forms[0].merk;
	}

	if (dropDown)  {
		dropDown.length = 0;

		for(index=0; index<make_d.length; index++)	{

			dropDown[index] = new Option(make_d[index],make_v[index]);
		
			if (make_d[index]=="Make" || make_d[index]=="MAKE")  { 
				dropDown[index] = new Option(make_d[index],"");
			  }

			if (make_d[index]=="ANY")  {  
				dropDown[index] = new Option("","0");
			  }
			
			if(make_v[index].toUpperCase() == search_brand){
			//if(make_v[index].toUpperCase() == search_brand.toUpperCase()){
			//if(make_v[index] == 'peugeot'){
				selectedIndex = index;
			}
		  }
		dropDown.options[selectedIndex].selected = true;
		//dropDown.options[5].selected = true;
	}
	
	//select_make(search_brand);
	//var search_brand;
	//search_brand = 'Peugeot';
	select_make(search_brand);
	//document.forms[0].merk.options[5].selected=true;
}

function get_range(ranges,req_model)	{

	selectedIndex = 0;		
	var dropDown;

	if (document.qSearch && document.qSearch.model)  {
		dropDown = document.qSearch.model;
	}
	else if(document.formsearch && document.formsearch.model)  {
		dropDown=document.formsearch.model;
	}
	else if (document.forms[0] && document.forms[0].model)  {
		dropDown = document.forms[0].model;
	}

	if (dropDown)  {

		dropDown.length = 0;

		for(index=0; index<ranges.length; index++)	{

			dropDown[index] = new Option(ranges[index],ranges[index]);

			if (ranges[index]=="Model" || ranges[index]=="MODEL")  {  
				dropDown[index] = new Option(ranges[index],"");
			  }

			  if (ranges[index]=="ANY")  {  
				dropDown[index] = new Option("","0");
			  }

			if(ranges[index].toUpperCase() == req_model){
				selectedIndex = index;
			}
			else if (ranges[index].toUpperCase() == "ANY MODEL" && req_model == "ANY")  {
				selectedIndex = index;
			}
		}
if(dropDown.type=='select-one' && dropDown.options[selectedIndex])
	dropDown.options[selectedIndex].selected = true;
	}
}

function select_make(search_brand)  {
	
	if (search_brand == null)  {
		search_brand="";
	}
	
	var search_brand;
	search_brand = 'Peugeot';
	
	for (x=0; x<document.forms[0].merk.length; x++)  {
		mk=document.forms[0].merk.options[x].value;
		if ( mk.toUpperCase()==search_brand)  {
		//test = "Peugeot";
		//if ( mk.toUpperCase()==test)  {
			if (document.forms[0].merk.options[x].selected==false)   {
				document.forms[0].merk.options[x].selected=true;
			}
		}
	}
	
	//document.forms[0].merk.options[5].selected=true;
}
