
var currentModelSelectId = '';

function selectMark(markId, prefix, titleId) {
	if (!prefix) {
		prefix='autodoQuickSearchModel';
	}
	if (currentModelSelectId) {
		document.getElementById(currentModelSelectId).style.display = 'none';
	}
	if (markId) {
		document.getElementById(prefix+markId).style.display = 'block';
		currentModelSelectId = prefix+markId;
		if (titleId) {
			document.getElementById(titleId).style.display = 'block';
		}
	}
	else {
		currentModelSelectId = '';
		if (titleId) {
			document.getElementById(titleId).style.display = 'none';
		}
	}
}

function checkAll(allId, checkboxesName) {
	allCheckbox = document.getElementById(allId);
	checkboxes = document.getElementsByName(checkboxesName);
	if (allCheckbox.checked) {
		for (c=0; c<checkboxes.length; c++) {
			checkboxes[c].checked = false;
		}
	}
	else {
		allCheckbox.checked = true;
	}
}

function checkSingle(allId, checkboxesName) {
	allCheckbox = document.getElementById(allId);
	checkboxes = document.getElementsByName(checkboxesName);
	checkCount = 0;
	for (c=0; c<checkboxes.length; c++) {
		if (checkboxes[c].checked) {
			checkCount++;
		}
	}
	allCheckbox.checked = checkCount?false:true;		
}