arrmodels=new Array();
arrmakes=new Array();

	
	function initMake(){
		var oList2 = document.theform_1.ddMake;
		clearDynaList(oList2);
		oList2[oList2.length]= new Option("All Makes");
	}
	function initModel(){
		var oList3 = document.theform_1.ddModel;
		clearDynaList(oList3);
		oList3[oList3.length]= new Option("All Models");
	}
	function initYear(){
		var oList4 = document.theform_1.ddYear;
		clearDynaList(oList4);
		oList4[oList4.length]= new Option("All Years");
	}

	function  Searchmanual_default(){
		var oList2=document.theform_1.ddMake;
		initMake();
		initModel();
		initYear();
		arr_cars=return_array(cars);
		populateDynaList(oList2, arr_cars);
	 	return true;		
	}

	function changemakes(){
		var oList2=document.theform_1.ddMake;
		var oList3=document.theform_1.ddModel;
		var arrList="";
		var make="";
		initModel();
		initYear();
               if (oList2.selectedIndex!=0){
			make=document.theform_1.ddMake.options[document.theform_1.ddMake.selectedIndex].value	
			arr_models=return_array(arrmakes[make]);
			populateDynaList(oList3, arr_models);
			return true;
	       }		
	}

	function changemodels(){
		var oList4=document.theform_1.ddYear;
		var oList3=document.theform_1.ddModel;
		var arrList="";
		var status="";
		var make="";
		if (oList3.selectedIndex==-1){
  		oList3.selectedIndex = 0;
		 }
	        initYear();
               if (oList3.selectedIndex!=0){
			model=document.theform_1.ddModel.options[document.theform_1.ddModel.selectedIndex].value	
			arr_years=return_array(arrmodels[model]);
			populateDynaList(oList4, arr_years);
			return true;
		}	
	}
	//get the arrays from the string
	function return_array(cars){
		var j=0;
		arr_cars=new Array();
		apairs=cars.split(',');
		for(var i=0;i<apairs.length;i++){
			arr_cars[i]=apairs[i]
		}
		return arr_cars
}
	//clear the list
	function clearDynaList(oList){
 		for (var i = oList.options.length; i >= 0; i--){
 		oList.options[i] = null;
 		} 
		oList.selectedIndex = -1;
}
	//added options to the list
	function populateDynaList(oList, aArray){
 		for (var i = 0; i < aArray.length; i= i + 1){
   			oList.options[oList.options.length] = new Option(aArray[i], aArray[i]);
  		}
 		oList.selectedIndex = 0; 		
}


	function SubmitSearch(){	
	var make,model,year
	//make
	if (document.theform_1.ddMake.selectedIndex==0){
		make="";
	}
	if (document.theform_1.ddMake.selectedIndex>0) {
		make=document.theform_1.ddMake.options[document.theform_1.ddMake.selectedIndex].value;
	}
	//model
	if (document.theform_1.ddModel.selectedIndex==0) {
		model="";
	}
	if (document.theform_1.ddModel.selectedIndex>0) {
		model=document.theform_1.ddModel.options[document.theform_1.ddModel.selectedIndex].value;
	}
	//year
	if (document.theform_1.ddYear.selectedIndex==0) {
		year="";
	}
	if (document.theform_1.ddYear.selectedIndex>0) {
		year=document.theform_1.ddYear.options[document.theform_1.ddYear.selectedIndex].value;
	}
	
	var strQString = "?d="+ make+ "&m="+ model + "&y=" + year 

       
			window.location.href="/content/ownermanual/list.aspx"+strQString;

	}
	