// bSearch_SearchAll, iNewUsed and b_ShowUsedWithCert are set in parent file
var sNewUsed = ''
switch(iNewUsed) {
	// New
	case '0':
  		sNewUsed = '0'
		break;
	// Used  
	case '1':
		if (b_ShowUsedWithCert == true) {
			sNewUsed = '1,2'
		} else {
  			sNewUsed = '1'
		}
  		break;
	// Certified
	case '2':
  		sNewUsed = '2'
  		break;
	// New and Used
	case '3':
		if (b_ShowUsedWithCert == true) {
  			sNewUsed = '0,1, 2'
		} else {
  			sNewUsed = '0,1'
		}
  		break;
	// New and Cert
	case '4':
  		sNewUsed = '0,2'
  		break;
	// Used and Cert
	case '5':
  		sNewUsed = '1,2'
  		break;
	// New, Used and Cert
	case '6':
  		sNewUsed = '0,1,2'
  		break;
	// Default - show all - New, Used and Cert
	default:
  		sNewUsed = '0,1,2'
}

if (bSearch_SearchAll == 'true') {
	if (document.getElementById('chNew') != null) {
		if (document.getElementById('chNew').checked) { UpdateUsedFilter('chNew', 0) }
	}
	if (document.getElementById('chUsed') != null) {
		if (document.getElementById('chUsed').checked) { UpdateUsedFilter('chUsed', 1) }
	}
	if (document.getElementById('chCrtf') != null) { 
		if (document.getElementById('chCrtf').checked) { UpdateUsedFilter('chCrtf', 2) }
	}
	//if ((document.getElementById('chNew') == null) && (document.getElementById('chUsed') == null) && (document.getElementById('chCrtf') == null)) {
		// if newused QS is passed
		if (sNewUsed != '') {
			document.getElementById('fltUsed').value = sNewUsed
		}
	//}
} else {
	if (document.getElementById('rNewUsed') != null) {
		if ((document.frmAutoID.rNewUsed[0] != null) && (document.frmAutoID.rNewUsed[0].checked)) { UpdateUsedFilter('rNewUsed', 0) }
	}
	if (document.getElementById('rNewUsed') != null) {
		if ((document.frmAutoID.rNewUsed[1] != null) && (document.frmAutoID.rNewUsed[1].checked)) { UpdateUsedFilter('rNewUsed', 1) }
	}
	if (document.getElementById('rNewUsed') != null) {
		if ((document.frmAutoID.rNewUsed[2] != null) &&(document.frmAutoID.rNewUsed[2].checked)) { UpdateUsedFilter('rNewUsed', 2) }
	}
	//if (document.getElementById('rNewUsed') == null) {
		// if newused QS is passed
		if (sNewUsed != '') {
			document.getElementById('fltUsed').value = sNewUsed
		}
	//}
}