<!--
function PopulateRanges(i_blnNewManufacturer) {
/*
'******************************************************************************
'* Dynamically creates the range options available for selection depending
'* upon the selected Manufacturer
'*
'* Inputs:  i_blnNewManufacturer - Indicates whether to display default "Any" value
'*                                 for a new manufacturer or display previous
'*                                 selection recalling server side hidden value
'******************************************************************************
*/
var i;
var manCode;

	// get currently selected Manufacturer code
	with (document.SearchForm.selManufacturer) {
		manCode = options[selectedIndex].value;
	}

	var ranges = eval("objRanges.code" + manCode);

	// clear the current options
	document.SearchForm.selRange.options.length = 0;

	for (i=0; i < ranges.length; i++) {
		// create and add new option to the Ranges SELECT
		var k = document.SearchForm.selRange.options.length;
		document.SearchForm.selRange.options[k] = new Option(ranges[i].desc, ranges[i].code);
	}

	// select the range appropriately
	if (i_blnNewManufacturer) {
		document.SearchForm.selRange.selectedIndex = 0;
		// re-set the hidden form field values
		document.SearchForm.hdnRangeIndex.value = "0";
		document.SearchForm.hdnRangeCode.value = "";
	}
	else
		document.SearchForm.selRange.selectedIndex = document.SearchForm.hdnRangeIndex.value;
}

function showModels(mk) {
	var i;
	var models;

	if (mk == "*")
		// map 'any' to make 0
		mk = 0;

	// get the appropriate list of models for makecode 'mk'
	eval("models = objRanges.mk" + mk);
	with(document.SearchForm.selRange) {
		// remove the previous options
		for (i = length-1; i > 1; i--) {
			options[i] = null;
		}
		// populate the SELECT with the new options
		options[0] = new Option("Select a model", "*", true, true);
		options[1] = new Option("--- any ---", "*");
		for (i = 0; i < models.length; i++) {
			options[2+i] = new Option(models[i], models[i]);
		}
	}
	// NS re-paint the SELECT without having to reload the page
	// with a history.go(0) by resizing the window as this loses
	// the newly set options in IE
	// window.resizeBy(-1, -1);
	// window.resizeBy(1, 1);
}

function doStockListWindow() {
//	alert(document.SearchForm.selManufacturer.value);

	// open a window
	StockWindow = window.open('about:blank','StockListWindow','scrollbars=yes,resizable=yes,width=650,height=480');
	// submit the form with this window as a TARGET
	document.SearchForm.submit();
	StockWindow.focus();
}

var StockListWindow = null;

function Range(i_strCode, i_strDesc) {
/*
'******************************************************************************
'* Constructor function for the Range object
'*
'* Inputs:  i_strCode - Range code
'*          i_strDesc - Range description
'******************************************************************************
*/

	// Range object constructor
	this.code = i_strCode;
	this.desc = i_strDesc;

}

function SetHiddenRangeValues() {
/*
'******************************************************************************
'* Sets hidden form input variables for Range index and code
'******************************************************************************
*/

	with (document.SearchForm) {
		hdnRangeIndex.value = selRange.selectedIndex;
		hdnRangeCode.value = selRange.options[selRange.selectedIndex].value;
	}
	
}

-->