function populateSelect(field, arrayName, empty) 
	{
		varField = eval(field);
		varFieldLen = varField.options.length;
		var varCurrentItems = new Array(varFieldLen);

		if(!empty) 
		{
			for (i=0;i<varField.length;i++) 
			{
				varCurrentItems[i] = new Array(1);
				varCurrentItems[i][0] = varField.options[i].text;
				varCurrentItems[i][1] = varField.options[i].value;
			}	
		}
		
		for (i=0;i<varField.length;i++){varField.options[i]=null;}
		varField.options.length = 0;

		//create new options
		varArray = eval(arrayName);
		
		
		for (j=0;j<varArray.length;j++) 
		{
			displayString = varArray[j];
			var tempOption = new Option(displayString, displayString);
			varField.options[j] = tempOption;
		}
		
		varFieldLen = varField.options.length;

		if (!empty)
		{
			for (j=0;j<varCurrentItems.length;j++) 
			{
				var tempOption = new Option(varCurrentItems[j][0], varCurrentItems[j][1]);
				varField.options[varFieldLen+j] = tempOption;
			}
		}
	}      
function populateSeries(formName, makeField, seriesField, arrayName, carType) {
	with (eval("document." + formName)) {
		
		varMakeField = eval(makeField);
    if (varMakeField.options) {
      tempNum = varMakeField.selectedIndex;
    } else {
  		varMakeFieldANO = eval(makeField+'ANO');
  		tempNum = varMakeFieldANO.value;
    }
		
		//empty out series box
		varSeriesBox = eval(seriesField);
		for (i=0;i<varSeriesBox.lenght;i++) {
			varSeriesBox.options[i]=null
		}
		varSeriesBox.options.length = 0;
		
		//create new options
		varCarArray = new Array();
		varCarArray = eval(arrayName);
		
		//split new and used 0 = New, 1 = Used
		if (carType == 0) {
			for (j=0;j<varCarArray[tempNum].length;j++) {
				seriesString = varCarArray[tempNum][j];
				var tempOption = new Option(seriesString, seriesString);
				varSeriesBox.options[j] = tempOption;
			}
		} else {
			for (j=0;j<varCarArray[tempNum].length;j++) {
				seriesString = varCarArray[tempNum][j];
				starPos = seriesString.indexOf("*");
				if (parseInt(starPos) > 0) {
					displayString = seriesString.substring(0,parseInt(starPos));
					valueString = seriesString.substring(parseInt(starPos) + 1,seriesString.length);
				} else {
					displayString = seriesString;
					valueString = "All";
				}
				var tempOption = new Option(displayString, valueString);
				varSeriesBox.options[j] = tempOption;
			}
		}
		
	}
}

//generic populate scripts
function populateMakes(formName, makeField, seriesField, arrayName, carType) {
	with (eval("document." + formName)) {
		varFormField = eval(makeField);
    //alert(varFormField.options);
    if (varFormField.options) {
  		
  		for (i=0;i<varFormField.lenght;i++) {
  			varFormField.options[i]=null
  		}
  		
  		varFormField.options.length = 0;
  		varCarArray = new Array();
  		varCarArray = eval(arrayName);
  		
  		for (i=0;i<varCarArray.length;i++) {
  			var tempOption = new Option(varCarArray[i].value, varCarArray[i].value)
  			varFormField.options[i] = tempOption;
  		}
    
    }
		
		//populate series box
		populateSeries(formName, makeField, seriesField, arrayName, carType);
	}
}

