function isYear(yearVal) {
	var yearInt = parseInt(yearVal);
	return ((yearInt > 1800) && (yearInt < 10000)) ? true : false;
}
function checkForm() {
	if (document.dbform.Data11.selectedIndex > 0 && document.dbform.Data12.selectedIndex > 0 && document.dbform.Data13.value == '') {
		alert('Please provide a start year.');
		return false;
	}
	if (document.dbform.Data14.selectedIndex > 0 && document.dbform.Data15.selectedIndex > 0 && document.dbform.Data16.value == '') {
		alert('Please provide an end year.');
		return false;
	}
}
function checkSection(listObj,secName) {
	var secObj = eval('document.dbform.' + secName);
	var itemSel = false;
	for (var i = 0; i < listObj.options.length; i++) {
		if (listObj.options[i].selected) itemSel = true;
	}
	if (itemSel && secObj.selectedIndex == 0) {
		secObj.options[1].selected = true;
	} else if (!itemSel) {
		secObj.options[0].selected = true;
	}
}
function checkLoc(listID) {
	var locCtrl = eval('document.dbform.Data40');
	for (i = 0; i < locCtrl.length; i++) {
		if (listID == parseInt(locCtrl[i].value)) {
			locCtrl[i].checked = true;
			break;
		}
	}
}
var dWin;
function showDoc(docID) {
	if (docID) {
		if (dWin) {
			if (!dWin.closed) dWin.close();
		}
		dWin = window.open('showdoc.asp?id=' + docID,'dWindow','toolbar=no,location=no,scrollbars=yes,width=500,height=350,resizable=yes');
	}
}
function listChk(inControl, outControl, numControl) {
	var chkList = '';
	for (i = 1; i <= numControl; i++) {
		if (eval('document.dbform.' + inControl + i + '.checked')) {
			chkList += (chkList != '') ? ',' : '';
			chkList += eval('document.dbform.' + inControl + i + '.value');
		}
	}
	eval('document.dbform.' + outControl + '.value = \'' + chkList + '\'');
	//if (chkList != '') checkSection(this,'Data03');
}
function colChk() {
	var colBox;
	var colTotal = 0;
	for (i = 0; i <= 5; i++) {
		colBox = eval('document.dbform.Col' + i);
		if (colBox.checked) {
			colTotal += parseInt(colBox.value);
		}
	}
	document.dbform.Data7.value = colTotal;
}
function clearList(listName, ctrlNames) {
	var ctrlObj, i, x;
	if (listName.selectedIndex == 0) {
		var ctrlArray = ctrlNames.split(',');
		for (i = 0; i < ctrlArray.length; i++) {
			ctrlObj = eval('document.dbform.' + ctrlArray[i])
			if (ctrlObj) {
				for (x = 0; x < ctrlObj.options.length; x++) {
					ctrlObj.options[x].selected = false;
				}
			}
		}
		if (ctrlNames == 'Data20') {
			document.dbform.Data21[1].checked = true;
		}
	}
}
function defineSelect(ctrlName, ctrlText) {
	var ctrlObj = eval('document.dbform.' + ctrlName)
	if (ctrlObj.selectedIndex >= 0) {
		var searchTerm = ctrlObj.options[ctrlObj.selectedIndex].text;
		if (searchTerm != '') {
			popupWindow(1,550,350, 'CC/SDB/SDBrecord.asp?SDBaction=show&mode=GV&term=' + searchTerm);
		}
	} else {
		alert('Please select an item from the ' + ctrlText + ' list!');
	}
}
