
function loadProductList()
{
	var tmpSel,measurement,capacity,coupling,accuracy,technology,model;
	tmpSel = document.getElementById('measurement');
	if (tmpSel.options[tmpSel.selectedIndex].value.toString() != '') {
		measurement = tmpSel.options[tmpSel.selectedIndex].value;
	}
	tmpSel = document.getElementById('capacity');
	if (tmpSel.options[tmpSel.selectedIndex].value.toString() != '') {
		capacity = Number(tmpSel.options[tmpSel.selectedIndex].value);
	}
	tmpSel = document.getElementById('coupling');
	if (tmpSel.options[tmpSel.selectedIndex].value.toString() != '') {
		coupling = tmpSel.options[tmpSel.selectedIndex].value;
	}
	tmpSel = document.getElementById('accuracy');
	if (tmpSel.options[tmpSel.selectedIndex].value.toString() != '') {
		accuracy = Number(tmpSel.options[tmpSel.selectedIndex].value);
	}
	tmpSel = document.getElementById('technology');
	if (tmpSel.options[tmpSel.selectedIndex].value.toString() != '') {
		technology = tmpSel.options[tmpSel.selectedIndex].value;
	}
	results = new Array();
	for (i=0; i<products.length; i++) {
		model = new Object();
		for (field in products[i]) { model[field] = products[i][field]; }
		if (Boolean(measurement) && model.MeasurementType != measurement) { continue; }
		if (Boolean(capacity) && torqueConversion(model.UpperCapacity,model.CapacityUnits.replace('-','').toLowerCase()) < capacity) { continue; }
		if (Boolean(coupling) && model.Coupling != coupling) { continue; }
		if (Boolean(accuracy)) {
			switch (model.AccuracyClass) {
				case 'Low Accuracy Class' : if (accuracy > 1) continue;
				case 'Standard Accuracy Class' : if (accuracy > 2) continue;
				case 'High Accuracy Class' :
				default : break;
			}
		}
		if (Boolean(technology) && model.Technology != technology) { continue; }
		model.Capacity = (model.CapacityUnits == 'Custom' ? model.CapacityUnits : 'Up to ' + model.UpperCapacity + ' ' + model.CapacityUnits);
		results[model.ModelNumber] = model;
	}
	displayProductList();
}

function torqueConversion(n,u)
{
	var inlb = {'inoz':n*6.250e-2,'inlb':n*1,'ftlb':n*12,'nm':n*8.85074579133};
	return inlb[u];
}

// Define overlib help texts
/*
var help_texts = {
		'measurement':{
			'text':'',
			'caption':'Measurement Type',
			'hpos':LEFT
		},
		'capacity':{
			'text':'',
			'caption':'Capacity',
			'hpos':LEFT
		},
		'coupling':{
			'text':'',
			'caption':'Coupling',
			'hpos':LEFT
		},
		'accuracy':{
			'text':'',
			'caption':'Accuracy',
			'hpos':LEFT
		},
		'technology':{
			'text':'',
			'caption':'Technology',
			'hpos':LEFT
		}
};
*/
var compareHeaders = {'ModelNumber':'Model','ApplicationNotes':'Application Notes','MeasurementType':'Measurement Type','Application':'Application','Capacity':'Capacity','Coupling':'Coupling','AccuracyClass':'Accuracy','Technology':'Technology','ChannelCount':'Channels','BoltHolePattern':'Bolt Hole Pattern'};